Allow skipping fields in Magento form validation


Sometimes we want to dynamically decide if a form field should be validated or not. Out of the box Prototype Validation does not allow that, instead all form elements are validated.

However, with a simple modification to validator we can skip validating all fields with skip-validation class.

Add your script after js/prototype/validation.js and you are done.

In a non-obstructive way, form validation behaviour can be changed simply by adding class to form fields.