tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcus Schulte (JIRA)" <...@tapestry.apache.org>
Subject [jira] Issue Comment Edited: (TAPESTRY-1806) Client-Side Validation doesn't work correctly
Date Mon, 05 Nov 2007 12:15:50 GMT

    [ https://issues.apache.org/jira/browse/TAPESTRY-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540181
] 

mschu edited comment on TAPESTRY-1806 at 11/5/07 4:14 AM:
-------------------------------------------------------------------

caused by the fix for TAPESTRY-1663 in conjunction with flawed logic in dojo.validate :

  - <select> dom-nodes are "arrayLike"
  - dojo.validate.check  does not separate identifying an input controls type from checking
whether it's empty

fixed version in non-compressed format:

//...
// See if required input fields have values missing.
    if(profile.required instanceof Array){
        for(var i = 0; i < profile.required.length; i++){ 
            if(!dojo.lang.isString(profile.required[i])){ continue; }
            var elem = form[profile.required[i]];
            // Are textbox, textarea, or password fields blank.
            if(!dj_undef("type", elem) && (elem.type == "text" || elem.type == "textarea"
|| elem.type == "password" || elem.type == "file")){
                if ( /^\s*$/.test(elem.value) )
                    missing[missing.length] = elem.name;
            }
            // Does drop-down box have option selected.
            else if(!dj_undef("type", elem) && (elem.type == "select-one" || elem.type
== "select-multiple") ){
                if ( elem.selectedIndex == -1 
                     || /^\s*$/.test(elem.options[elem.selectedIndex].value ) )
                    missing[missing.length] = elem.name; 
            }
            // Does radio button group (or check box group) have option checked.
            else if(dojo.lang.isArrayLike(elem)){
                var checked = false;
                for(var j = 0; j < elem.length; j++){
                    if (elem[j].checked) { checked = true; }
                }
                if(!checked){   
                    missing[missing.length] = elem[0].name;
                }
            }
        }
    }
//...

      was (Author: mschu):
    caused by the fix for TAPESTRY-1663 in conjunction with flawed logic in dojo.validate
:

  - <select> dom-nodes are "arrayLike"
  - dojo.validate.check  does not separate identifying an input controls type from checking
whether it's empty
  
> Client-Side Validation doesn't work correctly
> ---------------------------------------------
>
>                 Key: TAPESTRY-1806
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1806
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Core Components
>    Affects Versions: 4.1.3
>            Reporter: Marco Valverde
>            Assignee: Marcus Schulte
>            Priority: Blocker
>
> If the data in a form is invalid a proper dojo dialog pops up. ok so far!
> But, if the data in the form is absolutely valid an empty dojo dialog pops up.
> In this case the dialog contains no message and only an OK-button.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Mime
View raw message