Ajaxify Form Validation

I’ve had trouble trying to validate jquery ajaxify forms using validation plugin

first I tried hacking onStart event but that would load the hash and fail at validation leaving me with a wrong hash in the URL bar

the thing that worked was hacking into the function that binds the event

I just asked there if the bind was for a form element and if so I called validate function
If it returned false I also returned false and effectively stopped form submission
hashes work fine, forms work fine

anyway, this is the piece of code for anyone interested

if(jQuery(this).is('form')) {
if (!jQuery(this).valid()) {
return false;

happy hacking :)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>