w2form.validate

Performs form validation.
validate([showErrors])
showErrors boolean, if true then it will display error bubbles on the screen (optional)
Returns array.

Description

The method will perform validation of the data, making sure all required fields are not blank and values are according to their field types. It will return an array of error objects. If this array is empty, then there are no errors.
It will populate last.errors array with the errors it finds as well as it will return them.
You can optionally supply showErrors argument that will make the method to display error bubbles next to the fields.
If you have form defined in the following way: You can do:

User Comments

comments powered by Disqus