How can I make ajaxForm work with the bassistance validation plugin?
I'm using ajaxForm to smooth help create a pleasant user experience for a simple contact form.
http://jquery.malsup.com/form/
I'd also like to use this plugin, so I don't have to create complex validation rules.
validation plugin
Trouble is, I can't figure out how to prevent form submission without first checking to see if the form is valid.
My attempts so far have been based on using submit() to prevent submission of the form if validations valid() method returns false.
But this doesn't seem to work. If I use ajaxForm, the submit() function seems to work differently. A form will still be submitted, despite a return false.
validate has a valid() method that returns false if the form fails validation.
How can I submit the form only if valid doesn't return false?
I've tried this:
- $('#contact-form').submit(function(){
- if ( $('#contact-form').valid() != 1)
- {
- return false ;
- }
- });
But the form gets submitted even if the valid() returns false.