You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Leneveut Michaël (JIRA)" <ji...@apache.org> on 2007/08/03 08:24:05 UTC

[jira] Created: (WW-2084) Double and int validation not generating good Javascript

Double and int validation not generating good Javascript
--------------------------------------------------------

                 Key: WW-2084
                 URL: https://issues.apache.org/struts/browse/WW-2084
             Project: Struts 2
          Issue Type: Bug
    Affects Versions: 2.1.0
         Environment: Windows XP, JDK 5
            Reporter: Leneveut Michaël


If I put int or double validation, the Javascript in not well generated, and the fields are not validated, due to "false" expressions in the javascript "if" tests.

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

Generated Javascript onsubmit method :
        // 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;
                }
            }
        }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WW-2084) Double and int validation not generating good Javascript

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2084?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Holmes resolved WW-2084.
------------------------------

    Resolution: Not A Problem

I think you may be confusing what the int and double validators are supposed to do. They are used to check that a value is inside a specified range. See the following pages for more information on how to properly configure the validators:

http://cwiki.apache.org/confluence/display/WW/int+validator
http://cwiki.apache.org/confluence/display/WW/double+validator

Right now you are getting the if (false || false) Javascript because you have not specified the range values in your configuration.

Also, I verified in IE and FireFox (used Firebug) that the JavaScript being generated was well formed. If you have a specific issue with the JavaScript output that you feel is broken , feel free to reopen this ticket.

In general, it's best to ask questions on the Struts users mailing list before opening a JIRA ticket:

http://struts.apache.org/mail.html



> Double and int validation not generating good Javascript
> --------------------------------------------------------
>
>                 Key: WW-2084
>                 URL: https://issues.apache.org/struts/browse/WW-2084
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.1.0
>         Environment: Windows XP, JDK 5
>            Reporter: Leneveut Michaël
>            Assignee: James Holmes
>             Fix For: 2.1.0
>
>         Attachments: Test.war
>
>
> If I put int or double validation, the Javascript in not well generated, and the fields are not validated, due to "false" expressions in the javascript "if" tests.
> <validators>
>     <field name="familleProduit.chargeTravail">
>         <field-validator type="double">
>             <message key="errors.double"/>
>         </field-validator>
>     </field>
> </validators>
> Generated Javascript onsubmit method :
>         // 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;
>                 }
>             }
>         }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2084) Double and int validation not generating good Javascript

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2084?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Holmes updated WW-2084:
-----------------------------

    Fix Version/s: 2.1.0
         Assignee: James Holmes

> Double and int validation not generating good Javascript
> --------------------------------------------------------
>
>                 Key: WW-2084
>                 URL: https://issues.apache.org/struts/browse/WW-2084
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.1.0
>         Environment: Windows XP, JDK 5
>            Reporter: Leneveut Michaël
>            Assignee: James Holmes
>             Fix For: 2.1.0
>
>         Attachments: Test.war
>
>
> If I put int or double validation, the Javascript in not well generated, and the fields are not validated, due to "false" expressions in the javascript "if" tests.
> <validators>
>     <field name="familleProduit.chargeTravail">
>         <field-validator type="double">
>             <message key="errors.double"/>
>         </field-validator>
>     </field>
> </validators>
> Generated Javascript onsubmit method :
>         // 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;
>                 }
>             }
>         }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2084) Double and int validation not generating good Javascript

Posted by "Leneveut Michaël (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2084?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leneveut Michaël updated WW-2084:
---------------------------------

    Attachment: Test.war

A sample application containing the test pages.

Runs on TomCat 5.5 with JDK 5

> Double and int validation not generating good Javascript
> --------------------------------------------------------
>
>                 Key: WW-2084
>                 URL: https://issues.apache.org/struts/browse/WW-2084
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.1.0
>         Environment: Windows XP, JDK 5
>            Reporter: Leneveut Michaël
>         Attachments: Test.war
>
>
> If I put int or double validation, the Javascript in not well generated, and the fields are not validated, due to "false" expressions in the javascript "if" tests.
> <validators>
>     <field name="familleProduit.chargeTravail">
>         <field-validator type="double">
>             <message key="errors.double"/>
>         </field-validator>
>     </field>
> </validators>
> Generated Javascript onsubmit method :
>         // 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;
>                 }
>             }
>         }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2084) Double and int validation not generating good Javascript

Posted by "Leneveut Michaël (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2084?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_41878 ] 

Leneveut Michaël commented on WW-2084:
--------------------------------------

I send a message to the list : http://www.nabble.com/-S2--Bug-v2.1.0-for-double-and-int-validation-tf4222645.html#a12012115

but nobody answered.

So how do we do for a int or double validation without range ? How to say 0 to Integer.MAX_INT ?

> Double and int validation not generating good Javascript
> --------------------------------------------------------
>
>                 Key: WW-2084
>                 URL: https://issues.apache.org/struts/browse/WW-2084
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.1.0
>         Environment: Windows XP, JDK 5
>            Reporter: Leneveut Michaël
>            Assignee: James Holmes
>             Fix For: 2.1.0
>
>         Attachments: Test.war
>
>
> If I put int or double validation, the Javascript in not well generated, and the fields are not validated, due to "false" expressions in the javascript "if" tests.
> <validators>
>     <field name="familleProduit.chargeTravail">
>         <field-validator type="double">
>             <message key="errors.double"/>
>         </field-validator>
>     </field>
> </validators>
> Generated Javascript onsubmit method :
>         // 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;
>                 }
>             }
>         }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.