In more complex forms it can be useful to validate one or more fields based on what the user selected on another field. For instance, make field A mandatory when the option X is selected and make the field B mandatory when the option Y is selected.
Sometimes it’s useful to trigger some actions when your form of field is validated.
Parsely 2.x allows you to use trigger events to this end. Events can be used to change DOM elements or to get access to the list of error messages for the form of fields. We’ll also take a look at the objects created by Parsley and how do they work.
So you’ve read the basic Parsley usage and it’s enough for simple forms. Now you have a few more complex validations and you don’t quite know how to get there.
In this case, take a look at this post where I’ll show you how to use custom validations, build by you. I’ll also show you how to submit your form via AJAX when it’s validated by Parsley.
In the contact form of your site or your application’s forms, it’s essential to use form validation.
There was a time when a form was submitted and there were errors and the user had to provide all the information. These days this is unnacceptable and a serious issue regarding to user experience and usability.