views:

33

answers:

1

Hi, Given 2 text fields that (e.g. House Number, and House Name) on a form, and in order to be valid the user must enter a number or name in the appropriate field before the 'group' of 2 fields is considered valid.

A user could enter just a house number, or a house name, but entering a value in either field marks both of them valid.

Is there a way to do this in Dijit/Dojo? The idea of a composite or group of validation elements would be perfect.

Thanks,

A: 

dijit.form.Form has an isValid function that by default makes sure all of its children dijit.form widgets are valid. You can use stock dijit.form.ValidationTextBox widgets in combination with attributes like regexp and required, or descendants like NumberTextBox to specify validation rules.

peller