tmt.validator.validateField()

tmt.validator.validateField(field, [callback]) allows to programmatically validate one field

First argument is required. It can be either an id (string) or a DOM node reference

Second argument is optional; it can be an error callback. If not specified, a plain JavaScript alert will be used
If a custom call back is specified, the validator will pass two arguments to it:

  1. fieldNode: a reference to the field DOM node
  2. validator: a validator object (containing name and message properties)

Please note the callback function gets invoked even if the field doesn't contain errors. In this case the "validator" argument is null. This way it can reset error display and clean-up the GUI. This is especially important for forms that get submitted using Ajax, without refreshing the page.

Generic Form
Validate onblur
Validate
Validate. Display error inside a box
Validate
You would like to take a drink with: (you can pick only one, sorry)





Validate
You would like to take go for a dinner with: Validate onchange
Italy's major contributions to modern civilization?
(pick at least one)



Validate