The problem with the empty field value is the Ognl 2.6.3 bug we've been
waiting for a fix to for a while now... 

You also get number format messages for non int values? That's a bug...
It should just add a field error...

> -----Original Message-----
> From: James Cook [mailto:[EMAIL PROTECTED] 
> Sent: Friday, October 31, 2003 1:36 PM
> To: [EMAIL PROTECTED]
> Subject: [OS-webwork] Any hope of validating empty input text?
> 
> 
> I have the following field in my Action:
> 
>       Integer _personIDNumber;
> 
> And the following input field in my JSP:
> 
> <input type="text" name="personIDNumber" value="" />
> 
> My validation requirements are:
> 
> <validators>
>     <field name="personIDNumber">
>         <field-validator type="required">
>             <message>You must enter a value for person ID 
> number.</message>
>         </field-validator>
>     </field>
> </validators>
> 
> When the code executes and I supply no value in the input 
> box, I get the following OGNL exception:
> 
> com.opensymphony.xwork.interceptor.ParametersInterceptor] 
> Setting params {personIDNumber=[Ljava.lang.String;@f3387}
> java.lang.NumberFormatException: For input string: "" 
> java.lang.NumberFormatException.forInputString(NumberFormatExc
> eption.jav
> a:48)
> java.lang.Long.parseLong(Long.java:344)
> java.lang.Long.parseLong(Long.java:381)
> ognl.OgnlOps.longValue(OgnlOps.java:85)
> ognl.OgnlOps.convertValue(OgnlOps.java:209)
> ognl.DefaultTypeConverter.convertValue(DefaultTypeConverter.java:50)
> com.opensymphony.xwork.XWorkBasicConverter.convertValue(XWorkB
> asicConver
> ter.java:80)
> 
> So outside of JavaScript client-side checking is there any 
> hope of handling this error in my action? Same goes if I 
> enter a non-numeric value in the textfield.
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program. 
> Does SourceForge.net help you be more productive?  Does it
> help you create better code?   SHARE THE LOVE, and help us help
> YOU!  Click Here: http://sourceforge.net/donate/ 
> _______________________________________________
> Opensymphony-webwork mailing list 
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> 


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to