Forums Forums Search & Filter Pro Prevent Range – Number from auto submit

Tagged: ,

Viewing 5 posts - 11 through 15 (of 15 total)
  • Anonymous
    #249972

    Sorry for being so annoying but where is this triggered? Maybe I can make a quick fix and not update the plugin for a while.
    Otherwise I think I need to replace the plugin with something else :/

    Trevor
    #250047

    It is triggered in the JavaScript file I think, but our developer would better know the answer to that. I have referred this thread to him for his input.

    Ross Moderator
    #250095

    Hi Johan

    You can disable auto submit, and then implement an autosubmit yourself if you know a little JS.

    Right now its an all or nothing approach.

    I can’t actually see your example to say whether it is working as it should or not.

    One way around it would be to prevent the user from entering text for the slider, so change the input type to “plain text”:

    If you must edit the file, then our javascript is:
    search-filter-pro\public\assets\js\search-filter-build.min.js

    But that is minified, so instead, take a look at:
    search-filter-pro\public\assets\js\search-filter-build.js (no .min)
    And remove line 3315 which is this code block:

    //only try to update if the values have actually changed
    if((slider_start_val!=min_formatted)||(slider_end_val!=max_formatted)) {
    
    	self.inputUpdate(800);
    }

    and you want to remove:
    self.inputUpdate(800); (this is line 3315)

    Once you’ve done that, you probably want to copy and paste the new code, into search-filter-build.min.js because that’s probably the version your site will be loading.

    Thanks

    Anonymous
    #250119

    Hi Ross,
    Thank you so much for pointing me in the right direction!

    As I’m only using the Range – Number with no slider I changed line 2985. So instead of autoupdate on input I’m using focusout. So the new code would is:

    $this.on('focusout', 'input[type="number"]', function(e) {
      self.inputUpdate(100);
    });

    In my humble opinion this is the desired behavior because otherwise if you stop typing for 800 ms the form updates and you’re not inside the input field anymore even if you’re not done. Happens a lot on mobile. Worst case, which is happening for my clients, is that other fields goes empty because they don’t match the max range. With focusout the form updates when actually done typing and has left the input field.

    You can have a look here if you want: https://www.serneholtestate.com/

    Anyways, thank you very much! 🙂

    Ross Moderator
    #250204

    Thanks for the udpate and feedback, we will surely have to add this as a customisable option to our plugin.

    Best

Viewing 5 posts - 11 through 15 (of 15 total)