tmt.validator.validateChildFields()

tmt.validator.validateChildFields(startNode, [callback]) allows to programmatically validate all the fields contained inside a given start node

Start node can be either an id (string) or a DOM node reference

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

  1. formNode: a reference to the form DOM node
  2. validators: An array of validator objects (containing name and message properties)

Please note the callback function gets invoked even if the fields don't contain errors. In this case the "validators" argument contains an empty array. 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

You can leverage this API to validate form inside a multi-panel widget, like an accordion

Generic Form
Validate fields contained inside <div id="section1">
(age, name, date and comments)
Same as above. Display errors inside a box
You would like to take a drink with: (you can pick only one, sorry)





Validate fields contained inside <div id="section2">
You would like to take go for a dinner with:
Italy's major contributions to modern civilization?
(pick at least one)



Same as above. Display errors inside a box