You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mleneveut <ML...@abusinessware.com> on 2007/08/06 09:33:34 UTC

[S2] Bug v2.1.0 for double and int validation

Hi,

I try to validate a double, but it generates this in my JSP :

        // field name: familleProduit.chargeTravail
        // validator name: double
        if (form.elements['familleProduit.chargeTravail']) {
            field = form.elements['familleProduit.chargeTravail'];
            var error = "Le champ doit être un décimal";
            if (field.value != null) {
                var value = parseFloat(field.value);
                if (false ||
                        false ||
                        false ||
                        false) {
                    addError(field, error);
                    errors = true;
                }
            }
        }

So the double is not tested.

my xxAction-validation.xml :
<validators>
    <field name="familleProduit.nomFamille">
        <field-validator type="requiredstring">
                        true
            <message key="errors.required"/>
        </field-validator>
    </field>
    <field name="familleProduit.chargeTravail">
        <field-validator type="double">
            <message key="errors.double"/>
        </field-validator>
    </field>
    <field name="familleProduit.gamme.idGamme">
        <field-validator type="requiredstring">
                        true
            <message key="errors.required"/>
        </field-validator>
    </field>
</validators>


Same error occures with int validation.

	<field name="familleProduit.chargeTravail">
        <field-validator type="int">
            <message key="errors.int"/>
        </field-validator>
    </field>

generates :
	// field name: familleProduit.chargeTravail
        // validator name: int
        if (form.elements['familleProduit.chargeTravail']) {
            field = form.elements['familleProduit.chargeTravail'];
            var error = "Le champ doit être un entier";
            if (field.value != null) {
                var value = parseFloat(field.value);
                if (false ||
                        false) {
                    addError(field, error);
                    errors = true;
                }
            }
        }

I created an issue : https://issues.apache.org/struts/browse/WW-2084

If someone has an idea on how to bypass this error...

Thanks.
-- 
View this message in context: http://www.nabble.com/-S2--Bug-v2.1.0-for-double-and-int-validation-tf4222645.html#a12012115
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] Bug v2.1.0 for double and int validation

Posted by mleneveut <ML...@abusinessware.com>.
Here is a sample application containing the test pages :
http://oughacom.free.fr/Java/Test.war


mleneveut wrote:
> 
> Hi,
> 
> I try to validate a double, but it generates this in my JSP :
> 
>         // field name: familleProduit.chargeTravail
>         // validator name: double
>         if (form.elements['familleProduit.chargeTravail']) {
>             field = form.elements['familleProduit.chargeTravail'];
>             var error = "Le champ doit être un décimal";
>             if (field.value != null) {
>                 var value = parseFloat(field.value);
>                 if (false ||
>                         false ||
>                         false ||
>                         false) {
>                     addError(field, error);
>                     errors = true;
>                 }
>             }
>         }
> 
> So the double is not tested.
> 
> my xxAction-validation.xml :
> <validators>
>     <field name="familleProduit.nomFamille">
>         <field-validator type="requiredstring">
>                         true
>             <message key="errors.required"/>
>         </field-validator>
>     </field>
>     <field name="familleProduit.chargeTravail">
>         <field-validator type="double">
>             <message key="errors.double"/>
>         </field-validator>
>     </field>
>     <field name="familleProduit.gamme.idGamme">
>         <field-validator type="requiredstring">
>                         true
>             <message key="errors.required"/>
>         </field-validator>
>     </field>
> </validators>
> 
> 
> Same error occures with int validation.
> 
> 	<field name="familleProduit.chargeTravail">
>         <field-validator type="int">
>             <message key="errors.int"/>
>         </field-validator>
>     </field>
> 
> generates :
> 	// field name: familleProduit.chargeTravail
>         // validator name: int
>         if (form.elements['familleProduit.chargeTravail']) {
>             field = form.elements['familleProduit.chargeTravail'];
>             var error = "Le champ doit être un entier";
>             if (field.value != null) {
>                 var value = parseFloat(field.value);
>                 if (false ||
>                         false) {
>                     addError(field, error);
>                     errors = true;
>                 }
>             }
>         }
> 
> I created an issue : https://issues.apache.org/struts/browse/WW-2084
> 
> If someone has an idea on how to bypass this error...
> 
> Thanks.
> 

-- 
View this message in context: http://www.nabble.com/-S2--Bug-v2.1.0-for-double-and-int-validation-tf4222645.html#a12020794
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org