At 12:14 PM -0700 7/14/05, Jay Burgess wrote:
Yes. It's because the leading zero is saying the numbers are
"octal", so 01-07
are valid octals, 08-09 are invalid octals, and 10-12 are valid octals.
Jay's exactly right here. Your options:
(1) hack the Javascript validation; commons-validator provides a
mechanism for specifying your own Javascript and falls back to
loading it from the commons-validator.jar (well, in recent versions;
in earlier versions, the javascript was in the config XML files and
hacking it will be pretty obvious.) I'm pretty sure the server-side
validation doesn't care about octals.
(2) use a "mask" validator with a pattern like ^(0[1-9]|1[0-2])$
Joe
Jat
| Jay Burgess [Vertical Technology Group]
| "Essential Technology Links via RSS"
| http://www.vtgroup.com/
-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Sivakumar Santharam
Sent: Thursday, July 14, 2005 2:07 PM
To: user@struts.apache.org
Subject: struts validation framework
I am trying to restrict a field input value between 1 and 12. The user has to
enter like 01 or 02.. thro 12. The validation fails if I enter 08 or 09 and
for all other values from 01 thro 07 and 10 thro 12, it works fine. Again the
problem is only if I enable javascript validation.
Did anybody come across this peculiar behaviour? Any help is appreciated.
This is my sample code:
<field property="injuryTimeHour"
depends="intRange,minlength,maxlength">
<arg0 key="injury.time.hour" />
<arg1 name="minlength" key="${var:minlength}"
resource="false" />
<arg1 name="maxlength" key="${var:maxlength}"
resource="false" />
<var>
<var-name>minlength</var-name>
<var-value>2</var-value>
</var>
<var>
<var-name>maxlength</var-name>
<var-value>2</var-value>
</var>
<arg1 name="intRange" key="${var:min}"
resource="false"/>
<arg2 name="intRange" key="${var:max}" resource="false"/>
<var>
<var-name>min</var-name>
<var-value>1</var-value>
</var>
<var>
<var-name>max</var-name>
<var-value>12</var-value>
</var>
</field>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Joe Germuska
[EMAIL PROTECTED]
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction" -The Ex
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]