Hi there, I have a new function that I will be calling when the submit button is pressed for the form. I'm trying to use this validation, not a plug-in, for experience.
How would I iterate through all the forms, determine if they're all valid, before exiting out of the function. Though if they're all valid, return true and continue, otherwise if false, stay in the isFormValid function until all the forms are valid. Any ideas?
Here's what I've got so far.
function isFormValid() {
var valid = false;
$('form :input').each(function() {
var input = $(this);
label = $(input).prev();
if (!$.trim(input.val()).length) {
label.effect('pulsate', { times : 1 }, 400).addClass('required');
$(":input[value='']:not(.nofocus):visible:enabled:first").focus();
valid = false;
}
else if (input.attr('id') == 'email') {
if (!isValidEmailAddress(input.val())) {
label.effect('pulsate', { times : 1 }, 400).addClass('invalid')
input.val('');
$(":input[value='']:not(.nofocus):visible:enabled:first").focus();
valid = false;
}
}
});
}
Thanks