Forums › Forums › Search & Filter Pro › Conditional Submit
Tagged: V3
- This topic has 9 replies, 2 voices, and was last updated 4 years, 4 months ago by Trevor.
-
Anonymous(Private) June 14, 2020 at 10:54 pm #248684
Hi Trevor,
I was able to achieve this with my jquery code, but the auto-update for the dropdowns keeps on refreshing the code and overwriting the disabling of submit button. I do need auto update for dropdown based on user interaction so is there a way to overwrite this on my end? If not, then can you please provide a fix on priority?
Thanks
Anonymous(Private) June 21, 2020 at 11:50 pm #249579Hi Trevor,
Thanks for your response.
I tried above approach but it isn’t triggering code after ajax refresh.
Basically there are 2 drop down, and I want ‘continue’ button to be disabled unless user selects a valid value in both of the dropdowns.
As soon as user selects first dropdown, page is refreshed and button is active.
Here’s the code that I am adding in page header. Please let me know if I am missing anything obvious. Thanks
<script type="text/javascript"> jQuery(document).ready(function( $ ){ jQuery("input[value='Continue']").css('background-color','#eee').prop('disabled',true); }); jQuery(document).on("sf.ajaxformfinish",".searchandfilter",function(){ "use strict"; alert('form is changed'); jQuery('.searchandfilter .sf-field-post-meta-year').on('change', function() { a = jQuery('.sf-field-post-meta-year option:checked').val(); console.info(a); console.info(b); if((typeof a === "undefined") || (typeof b === "undefined") || (a.length == 0) || (b.length == 0)){ console.info('disabled'); jQuery("input[value='Continue']").css('background-color','#eee').prop('disabled',true); } else{ console.info('enabled'); jQuery("input[value='Continue']").css('background-color','#F96714').prop('disabled', false); } }); jQuery('.searchandfilter .sf-field-tag').on('change', function() { b = jQuery('.sf-field-tag option:checked').val(); console.info(a); console.info(b); if((typeof a === "undefined") || (typeof b === "undefined") || (a.length == 0) || (b.length == 0)){ console.info('disabled'); jQuery("input[value='Continue']").css('background-color','#eee').prop('disabled',true); } else{ console.info('enabled'); jQuery("input[value='Continue']").css('background-color','#F96714').prop('disabled', false); } }); }); });</script>
Anonymous(Private) July 12, 2020 at 1:09 am #252497Hi Trevor,
Yes, I have both auto count settings enabled since I need 2nd drop down to be refreshed based on value selected in first dropdown.
As you mentioned hide empty is also set.Could you please let me know when are you planning to push the requested feature since whatever I try isn’t working as of yet and auto count settings and hide empty checkbox are needed for other functionality so can’t disable them.
Hoping to get requested feature soon. Thanks
Requested feature: An option to disable (grey out) submit button until some values are selected in dropdowns.
Trevor(Private) July 13, 2020 at 2:57 pm #252617You say you have two form fields. Are you able to send me a live link/URL to your search page so I can take a look? I would be looking to make sure that both fields are not based on the same data source, e.g. two fields based on ‘Category’.
It would be best to create a separate feature request for the disabled submit button in the feature request forum.
-
AuthorPosts