You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Niall Pemberton (JIRA)" <ji...@apache.org> on 2006/07/19 15:31:35 UTC

[jira] Reopened: (VALIDATOR-163) [validator] validator-rules.xml JavaScript fails when field not present in jsp

     [ http://issues.apache.org/jira/browse/VALIDATOR-163?page=all ]

Niall Pemberton reopened VALIDATOR-163:
---------------------------------------

             

> [validator] validator-rules.xml JavaScript fails when field not present in jsp
> ------------------------------------------------------------------------------
>
>                 Key: VALIDATOR-163
>                 URL: http://issues.apache.org/jira/browse/VALIDATOR-163
>             Project: Commons Validator
>          Issue Type: Improvement
>         Environment: Operating System: All
> Platform: All
>            Reporter: Andrew Berridge
>            Priority: Minor
>         Attachments: javascript.zip, validator-rules.xml, validator-rules.xml
>
>
> Sometimes, esp. when writing a wizard-like interface, not all the form fields 
> will be present in a single jsp - each jsp asks for a subset of the required 
> data from the user. It's useful to validate each piece of data. If you use the 
> validator.xml as supplied, it will fail for rules where the particular field 
> doesn't exist in the jsp.
> I propose adding a check in each of the validators to check if the form field 
> is undefined (i.e. doesn't exist) before attempting to use its properties.
> Each validator must have the following line or similar (in the case 
> of "required") under the for (x in oRequired) { line:
> for (x in oRequired) {
>     if (form[oRequired[x][0]] != undefined) {
> Hope this is of use!
> Andrew

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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