You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Marcelo V. F. Menezes" <gn...@gmail.com> on 2006/07/15 16:22:39 UTC
Problem with floatRange in Struts Validator
Hi people, I´m newbie in Struts World...
I´m trying to configure the Struts validator.xml with floatRange argument
but it don´t work correctly. The validator doesn´t check the decimal value
of the 'min' and 'max' values:
<field property="bonus" depends="required,float,floatRange">
<msg name="floatRange" key="errors.greaterzero" />
<arg0 key="general.bonus" />
<arg1 name="floatRange" key="${var:min}" resource="false"/>
<arg2 name="floatRange" key="${var:max}" resource="false"/>
<var><var-name>min</var-name><var-value>00.01
</var-value></var>
<var><var-name>max</var-name><var-value>99.99
</var-value></var>
</field>
With this configuration, Validator don´t check if the number is greater than
00.00, it check just the integer "00".00 part so its don´t accept number
00,** (like 00,01) just 01,* * ...
Anybody knows if my configuration is correct?
Sorry my english.
Thank´s
Marcelo
--
---
Marcelo V. F. Menezes
0xB904EBB4 @ http://pgp.mit.edu
--
"queriam apenas se divertir e pensavam tratar-se de um mendigo, não de um
índio, o homem a quem incendiaram." - Defesa dos acusados de matar o índio
Pataxó Galdino Jesus dos Santos.
Re: Problem with floatRange in Struts Validator
Posted by Niall Pemberton <ni...@gmail.com>.
The struts-examples webapp has a floatRange example and I just tried
it using Struts 1.2.9 and it worked fine (tests for the range -2.17 to
3.14)
What version of Struts and Commons Valdiator are you using?
Also try changing the minimum value to "0.01" - I think putting
additional leading zeros might mean it gets treated as hex.
Also did you mean "00,01" because it doesn't accept a "comma"
character - needs to be a "." for decimal points. From memory Struts
1.3 / Validator 1.3.0 has some localized versions that do accept ","
for coutries that use that as a decimal point - although not sure if
it includes float range.
Niall
On 7/15/06, Marcelo V. F. Menezes <gn...@gmail.com> wrote:
> Hi people, I´m newbie in Struts World...
>
> I´m trying to configure the Struts validator.xml with floatRange argument
> but it don´t work correctly. The validator doesn´t check the decimal value
> of the 'min' and 'max' values:
>
> <field property="bonus" depends="required,float,floatRange">
> <msg name="floatRange" key="errors.greaterzero" />
> <arg0 key="general.bonus" />
> <arg1 name="floatRange" key="${var:min}" resource="false"/>
> <arg2 name="floatRange" key="${var:max}" resource="false"/>
> <var><var-name>min</var-name><var-value>00.01
> </var-value></var>
> <var><var-name>max</var-name><var-value>99.99
> </var-value></var>
> </field>
>
> With this configuration, Validator don´t check if the number is greater than
> 00.00, it check just the integer "00".00 part so its don´t accept number
> 00,** (like 00,01) just 01,* * ...
>
> Anybody knows if my configuration is correct?
>
> Sorry my english.
>
> Thank´s
>
> Marcelo
>
> --
> ---
> Marcelo V. F. Menezes
> 0xB904EBB4 @ http://pgp.mit.edu
> --
> "queriam apenas se divertir e pensavam tratar-se de um mendigo, não de um
> índio, o homem a quem incendiaram." - Defesa dos acusados de matar o índio
> Pataxó Galdino Jesus dos Santos.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org