Validatious 2.0

Easy form validation with unobtrusive JavaScript

Fiedset/div errors

When grouping field validations into divs or fieldsets, reporting will not happen on a per field basis. Instead errors will be displayed relative (as in top or bottom) to the div or fieldset. Apart from how the parent element is resolved, reporting works the same for both fields and block elements.

...

Should the above fieldset fail validation, the contained fields will be left untouched, but the fieldset would now look like:

  • Some error message
  • ...
...

Example

The following example groups the fields by adding validate_any to the fieldset class name. Errors will therefore not be displayed per field, but instead relative to the fieldset. The default error messages does not make a whole lot of sense with validate_any since all the error messages will be displayed at the top when in reality, making one field valid is enough. For this reason you should override the error messages in these cases.

Form centered reporting

Another usage for grouping validation to fieldsets/divs is to gather all error messages above (or below) the fields. This can be achieved by grouping fields with validate_all. In this case the default error messages start making sense again, but now they're not displayed adjacent to each field.

Next: Configuring reporting | Back to Reporting extension features index

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