Hello!
This kb article shows how to hide the next button in a multi page form.
https://formidableforms.com/knowledgebase/javascript-examples/#kb-conditionally-hide-next-buttons-in-a-multi-page-form
My problem is I need to hide the next button if 2 fields are empty. These are hidden fields. Is there a way to meet this condition?
Thanks for any advise!
This is the script of the KB article:
<script> jQuery(document).ready(function($){ var fieldID = 18; var showVal = 'Yes'; var $nextButton = $(".frm_button_submit"); //Hide next button by default if Yes is not already checked if (($("input[name^='item_meta[" + fieldID + "]']:checked").val() != showVal) && ($("input[type=hidden][name^='item_meta[" + fieldID + "]']").val() != showVal)) { $nextButton.css('visibility','hidden'); } $("input[name^='item_meta[" + fieldID + "]']").change(function(){ if ($("input[name^='item_meta[" + fieldID + "]']:checked").val() == showVal){ $nextButton.css('visibility','visible'); } else { $nextButton.css('visibility','hidden'); } }); }); </script>
You can add another condition to the code to check for your empty fields in this section of code:
$("input[name^='item_meta[" + fieldID + "]']").change(function(){
if ( $('#empty_field1_id').val() == '' && $('#empty_field2_id').val() == '' ) {
if ($("input[name^='item_meta[" + fieldID + "]']:checked").val() == showVal) {
$nextButton.css('visibility','visible');
} else {
$nextButton.css('visibility','hidden');
}
}
});
Thanks a lot @Victor Font !!
Please login or Register to submit your answer