Any chance to trigger the validation process manually?
BTW: Thanks for the great work!
I took a closer look at the code and found the "private" function "_validateForm".
I'm using the following jQuery snippet after the first submit attempt. So when the user goes back to the invalid field and changes the value to a valid one he/she gets validation feedback right away and doesn't have to hit submit again to see the result...
$("input[name^='poll_']").change(function() { validator._validateForm(null); });
Do you have any concerns with this approach? I guess there is a reason why this function is pseudo private.
Thanks again!
I just haven't had time to expose a proper public API to fit this use case. Using _validateForm is fine with the current version, but I would always check when you are upgrading to make sure everything still works as is.
I'm pretty swamped right now so I'd be very open to a PR with a better API for this use case.
I also think that a manual trigger function is a very good idea. ;-)
Me too. Having a public call to validate the whole form and another to validate just one given field would be super useful.
I was able to alter validate.js to call it manually as I wanted to integrate field validation with other validation types such as validation that involves more than one field. I did this by creating a wrapper around the call to the validation object. The wrapper is bound to an onclick event. I also had to remove a few lines in validate.js. I removed var _onsubmit = this.form.onsubmit and altered the code below that as well so that the lines below were just an anonymous function that called _validateForm(evt) upon creation of the ValidateForm object.
i really want a manual trigger too!!!
what's more , i don't want one with jq