A small but powerful unobtrusive form validation script that uses regular expressions to validate input, textarea and select list values.
At a glance:
- Unobtrusive javascript
- Validates multiple forms per page
- Multiple validation rules can be stipulated for each form field
- Leverages the power of Regular Expressions
- An additional callBack function can be defined within the form tags class attribute
- Validation rules are stipulated within harmless HTML comments, removing the need for adding invalid attributes to the DOM or extra in-line classnames to the form fields themselves (Caveat: it does mean therefore that comments are added to the HTML markup)
- Both input fields and their associated labels targeted, giving the developer two opportunities to visually indicate erroneous input to the user
- Both warnings and errors thrown warnings before the submit button has been pressed and errors after
- Individual fields can be validated
onchange or onblur
- Works with both implicit and explicit labels
View the current javascript source.
View page source to see the validation parameters within the HTML comments.