Validatious 2.0

Easy form validation with unobtrusive JavaScript

Field errors

The default behaviour of the reporting extension is to display all error messages for each field, before the label and input elements. The error messages are added as an unordered list with the class name messages. This class name can be configured through messagesClass, see configuring reporting for more info on how this works.

HTML example

Given the following HTML for a field:

Should this field fail, the following HTML would be generated:

  • Name is required

Should you want to display several messages for a single field, then the ul would just have more li's.

Example

The following example shows the default error reporting. Try to submit an empty form and use a DOM inspector to see how the HTML is altered. A little bit of CSS is added to make the text inside the failing divs red, and a brighter background to make it stand out.

Next: Fiedset/div errors | 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.