Skip to content

Instantly share code, notes, and snippets.

@anil826
Created June 12, 2019 06:55
Show Gist options
  • Save anil826/23a305720138222307e230f86f845a1f to your computer and use it in GitHub Desktop.
Save anil826/23a305720138222307e230f86f845a1f to your computer and use it in GitHub Desktop.
Darrelll
//f91c-fbee-dc28 , 7cf5-cdb6-598d component id of required fields
$(document).on('keyup','.existing_repeat_entry_panel #component-f91c-fbee-dc28 , #component-7cf5-cdb6-598d', function(){
//Check the value of requied filed
//Loop for repeat index
//37ac-1f73-b669 component id of repeat group
for (var repeat_index=0; repeat_index < window.formyoula.form_fields["37ac-1f73-b669"].get('repeat_value').length; repeat_index++ ) {
//Check the value of requied filed
if ($('#collapse_37ac-1f73-b669_'+repeat_index+' #component-f91c-fbee-dc28 .input_content').val() && $('#collapse_37ac-1f73-b669_'+repeat_index+' #component-7cf5-cdb6-598d .input_content').val()) {
//Enable the submit button
$(".finish").attr('disabled',false);
} else {
//Disable the submit button
$(".finish").attr('disabled',true)
alert("Required Field empty")
break;
}
}
})
//Change event for controlling field checkbox.
$("#component-714b-af3e-d683 .checkbox_input").change(function() {
//function for checking the submit button
var checkExist = setInterval(function() {
//Check if button is available on page
if ($('.finish').length) {
//Run the validation
for (var repeat_index=0; repeat_index < window.formyoula.form_fields["37ac-1f73-b669"].get('repeat_value').length; repeat_index++ ) {
//Check the value of requied filed
if ($('#collapse_37ac-1f73-b669_'+repeat_index+' #component-f91c-fbee-dc28 .input_content').val() && $('#collapse_37ac-1f73-b669_'+repeat_index+' #component-7cf5-cdb6-598d .input_content').val()) {
//Enable the submit button
$(".finish").attr('disabled',false);
} else {
//Disable the submit button
$(".finish").attr('disabled',true)
alert("Required Field empty");
break;
}
}
//Clear the interval
clearInterval(checkExist);
}
}, 100); // check every 100ms
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment