I'm new to dojo and could really use some help with the following 2 field validation examples.
In the following example of a dijit.form.ValidationTextBox field specifying the validator property seems to override the use of the regExp. (ie the field no longer adheres to the regExp rule). How to I make it do both?
<input dojoType="dijit.form.ValidationTextBox"
type="password"
name="password2"
id="password2"
maxLength="50"
trim="true"
regExp="[\w]+"
required="true"
validator="return this.value == dijit.byId('password').value"
invalidMessage="Confirmation password must match password"
/>
I have another similar example where one field depends on the value of another, but I don't have the syntax correct.
<input dojoType="dijit.form.ValidationTextBox"
type="text"
name="homePhone"
id="homePhone"
style="width:20%"
maxLength="10"
trim="true"
required="false"
regExp="[\d]{10}"
validator="return (dijit.byId('preferredContactMethod').value == "home") && (this.value != null)"
invalidMessage="Home phone required (ie. 9198887777)"
/>