Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Validation Re: Validation

#92092
Brightonmike
Member

I’m so close! The checkbox is working now. However, it still refuses to reject the submission if the fields on the last slide are not filled in. This is my code:

    /*
if there are errors don't allow the user to submit
*/
$('#registerButton').bind('click',function(){
if($('#slidequoteform').data('errors')){
alert('Please correct the errors in the Form. Make sure you have filled in all fields correctly - this makes it quicker for us to process your request. Please note we do log all IP addresses of submissions.');
return false;
}
if ( !$('#check').is(':checked') ) {
alert('You must accept out terms and conditions to proceed.');
return false;
}
if ( $(this).find('.required').val() ) {
alert('Please correct the errors in the Form. Make sure you have filled in all fields correctly - this makes it quicker for us to process your request. Please note we do log all IP addresses of submissions.');
return false;
}

});

I am still able to submit without the last field being filled in, despite it having the .required class. My full code is here: http://jsfiddle.net/brightonmike/pFduv/8/