Last active
July 1, 2019 14:16
-
-
Save anil826/ceb4b6d033244349dae8895d05f5f151 to your computer and use it in GitHub Desktop.
Check checkbox in repeat group validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Collect data of email checkbox | |
var email_check_uncheck_data = []; | |
//Check on next click | |
$('.next').on('click', function(e) { | |
e.stopImmediatePropagation(); | |
for (var repeat_index=0; repeat_index < window.formyoula.form_fields["7221-d2aa-1adf"].get('repeat_value').length; repeat_index++ ) { | |
//Looop for component data | |
for ( var i_component = 0; i_component < window.formyoula.form_fields["7221-d2aa-1adf"].get('repeat_value')[repeat_index].length; i_component++ ) { | |
/****************Code for email validation****************/ | |
if ( window.formyoula.form_fields["7221-d2aa-1adf"].get('repeat_value')[repeat_index][i_component].label == "Trimite Email" ) { | |
var email_value = window.formyoula.form_fields["7221-d2aa-1adf"].get('repeat_value')[repeat_index][i_component].value | |
email_value ? email_check_uncheck_data.push('Yes') : email_check_uncheck_data.push('No');; | |
} | |
} | |
} | |
//Check and throw alert | |
if ( email_check_uncheck_data.includes('Yes') && email_check_uncheck_data.length > 0 && is_product_available) { | |
$('.next').off('click'); | |
$(this).click(); | |
} else { | |
alert('Warning : Please check your contact email or Product list'); | |
return; | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment