You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2002/11/12 15:20:11 UTC

DO NOT REPLY [Bug 14471] New: - validator-rules.xml JavaScript fails when field not present in jsp

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14471>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14471

validator-rules.xml JavaScript fails when field not present in jsp

           Summary: validator-rules.xml JavaScript fails when field not
                    present in jsp
           Product: Struts
           Version: 1.1 Beta 2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Validator Framework
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: andrew_berridge@sandwich.pfizer.com
                CC: andrew_berridge@sandwich.pfizer.com


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

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>