struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <davelnew...@gmail.com>
Subject Re: Int Validator
Date Sat, 13 Jul 2013 11:46:10 GMT
The field value error comes from the type conversion process. The field
should be an int or an Integer, with the caveat that an int has a default
value of 0, which may not be desirable.

Save
 On Jul 12, 2013 11:56 PM, "Alireza Fattahi" <afattahi@yahoo.com> wrote:

> Hi,
>
> I want to validate the amount filed to be an integer with minimum value of
> 1
> I describe the field type as Integer (not int )
> Add below validation rule
>     <field name="amount">
>         <field-validator type="required" >
>             <message> ${getText("validate.required")}</message>
>         </field-validator>
>         <field-validator type="int">
>             <param name="min">10</param>
>             <message> ${getText("validate.int.min")}</message>
>         </field-validator>
>
>
> When the amount is empty I get validate.required error.
>
> When I type a text instead of integer I get  Invalid field value for field
> "amount" . I don't know where it comes from and how can I change it.
>
> Also please let me know if I should define the amount as int, Integer or
> String !
>
>
> ~Regards,
> ~~Alireza Fattahi

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message