Tuesday 15 March 2011

dojo - Overriding dijit validator function and using regExp attribute -


I'm new to dojo and actually can use some help in the following 2 field validation examples.

In the following example of a dijit.form.ValidationTextBox area, the use of regExp seems to override the validator property. (Ie the area no longer follows regExp rule). How do i do it

& lt; Input dojoType = "dijit.form.ValidationTextBox"
type = "password"
name = "password2"
id = "password2"
maxLength = "50"
trim = "true"
regExp = "[\ w] +" required = "true"
validator = "return.value == dijit.byId ('password'). Value"
invalidMessage = "Confirmation password matching password Should eat "/>

I have another similar example where one field is the value of another, but I do not have the correct syntax.

& lt; Input dojoType = "dijit.form.ValidationTextBox" type = "text"
name = "homephone" style = "width: 20%"
maxelag = "10"
trim = "true"
essential = "false"
regExp = "[\ D] {10}"
validator = "return (dijit.byId ('preferredContactMethod') value ==" Home ") & amp; amp; amp;; (this.value! = Null)"
invalidMessage = "Home phone is required (i.e. 9 1988887777)" />

correct; The default implementation of Dijit.form.ValidationTextBox.prototype.validator () is to match this. Check with ARXXPP, as well as against other such constraints. Take a look at the source to see how it is done. If you override it, then you have your own to provide the implementation. You can choose to assign your implementation prototype method and you can also override the result with 'and' your own tests, Wide, I think.


No comments:

Post a Comment