javascript - Xpages phone number -
in application have field have store phone number. field must not allow characters numbers. problem format like:
0752344234
and if add this, xpages save field as: 752344234
without 0.
question: method can use add 0 in front of numbers withouth using string type field?
use validateconstraint
validator:
<xp:inputtext id="inputtext1" value="..." disableclientsidevalidation="true"> <xp:this.validators> <xp:validateconstraint message="please enter digits phone number"> <xp:this.regex><![cdata[^[0-9]*$]]></xp:this.regex> </xp:validateconstraint> </xp:this.validators> </xp:inputtext>
the regular expression ^[0-9]*$
accepts number of digits , empty string. if want @ least 1 digit replace *
+
.
you don't need set input text field required.
you can decide you'd validation message appear. set option disableclientsidevalidation="false"
show message dialog box on client side or disableclientsidevalidation="true"
put message xp:message/xp:messages control.
Comments
Post a Comment