Adding the onsubmit handler
Introduction
Adding Validation to a form
- The example form
- Including rsv.js
- Defining your validation rules
- Adding the onsubmit handler
- The finished product
References
Now you've created your rules, you need to attach them to the form so that when the user submits the form, the RSV library validates the form with your rules. This is very easy, just add an onsubmit attribute to your form tag, like so:
<form ... onsubmit="return rsv.validate(this, rules)">
And you're done! Now continue to the next step to see the final result.