int feildvalidator with min and max <param> of struts2 is not validating properly
Jyothi Sree
Ranch Hand
Joined: Jun 14, 2010
Posts: 41
posted
0
Hi
In my struts2 applicaion , i have a jsp page with "phone" feild in it for which i have applied validation using the
<field-validator type="int">
<param name="min">4</param>
<param name="max">20</param>
<message key="errors.range"/>
</field-validator>
int type min and max is not validating for me ,it is giving a negative number when i try to give the correct greater than 4 numbers
I don't really know what you're saying, but a phone number (a) isn't an integer, and (b) certainly isn't in the range of 4-20.
What are you really trying to validate? A phone number? Or an integer?
Jyothi Sree
Ranch Hand
Joined: Jun 14, 2010
Posts: 41
posted
0
I doesn't mean the phone number there , any integer take as an age where i need to valiadate age in between 4 and 20
<feild name="age">
<field-validator type="int">
<param name="min">4</param>
<param name="max">20</param>
<message key="errors.range"/>
</field-validator>
</feild>
Then in the frontend if i submit the value for age more then 4 and less than 20 itz showing a negative number and still showing an error message .