Forums › Forums › Search & Filter Pro › Prevent Range – Number from auto submit
Tagged: range - number, V3
- This topic has 14 replies, 3 voices, and was last updated 4 years, 4 months ago by Ross.
-
Ross Moderator(Private) June 25, 2020 at 1:34 pm #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 line3315
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 line3315
)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(Private) June 25, 2020 at 3:09 pm #250119Hi 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(Private) June 26, 2020 at 9:39 am #250204Thanks for the udpate and feedback, we will surely have to add this as a customisable option to our plugin.
Best
-
AuthorPosts