Validatious 2.0

Easy form validation with unobtrusive JavaScript

Scoping validators

Validating forms on submit is all nice and swell, but what if your form has several buttons - only one or a few of which should trigger validation? An example could be a processes with Next, Previous and Cancel buttons - only the next button should probably trigger validation.

Validatious can scope validation to specific buttons only. By adding the class name "action" to the <input type="submit" />, only the buttons with this class name will trigger validation.

The class name can be changed through v2.Form.actionButtonClass. More on configuring Validatious.

v2.Form.actionButtonClass = 'do-validate';

Example

The following example shows how you can add a next, previous and cancel buttons to a form and use the class name to make only the next button trigger validation.

Try clicking the next button to see the validation kick in - then click previous or cancel to see the form submit even if the fields are invalid.

Next: Validate one or all fields in a group | Back to HTML extension features index

© 2008 Christian Johansen. Validatious is licensed with a BSD License, documentation and site content with CC Attribution-Share Alike. About.