I am surprised that noone else came across this issue. But for now, I think I will go with a custom validator. Unless I am missing something. Thanks, Harsh.
-----Original Message----- From: The Jasper [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 24, 2006 2:59 AM To: Struts Users Mailing List Subject: Re: Harsh: Issue with float validation instruts validator Near as I can tell a float s evaluated as Float(value). So, looking in the java specs we see that a float needs a 'decimal point, an exponent, or a float type suffix '. see http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html# 230798 for more information. As for the validwhen, that should either do an integer comaprison or a string comparison. I would guess that somehow it fails to recognize 0.0 as an int and does a string compare. Then 0.0 really is > 0. either compare against 0.0 and ignore all int values as not being floats, or write a custom validator, or wait for someone smarter than me to give you a usefull answer ;} mvg, Jasper On 5/23/06, Chaudhary, Harsh <[EMAIL PROTECTED]> wrote: > I have a field which is being validated as: > > <field property="income" depends="validwhen,float"> > <arg key="income" position="0"/> > <var> > <var-name>test</var-name> > <var-value> > ( *this* > 0 ) > </var-value> > </var> > </field> > > Well the validwhen has a bunch of other conditions. I just left them out > for clarity. > > Anyways, this field is a float and its valid when its value is greater > than 0. This works perfectly when I enter a 0 in the field i.e. I get an > error. But if I type in 0.0, it validates fine. Not only that, if I type > in .1 in the field, I get an error whereas this should be a valid value. > But 0.1 works fine. I can only think this is a bug in the validation. > > Has anyone else noticed this issue? Any ideas or workarounds? > > Harsh. > > --------------------------------------------------------------------- > 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]