Skip to content

Design Library

Validation

Form field validation can access values of the nearby input controls, which is useful for performing complex context-sensitive form validation. The same technique can be also used for auto-completion, populating combobox/listbox, and so on. The example below is a bit contrived, but all the input elements are named "name" (for city name and state name), and we use @RelativePath so that the validation of the state name refers to the capital name, and the validation of the city name refers to the state name.

States
State name
Capital city
City name
Other cities
City name
State name
Capital city
City name
Other cities
City name
City name
City name
State name
Capital city
City name
Other cities
City name
City name
City name

To implement this you need to provide a doCheckXXX method, where XXX is the name of your field. This should return a FormValidation object.