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=21043>.
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=21043

javascript mask validator fails when field is disabled (RC2)

           Summary: javascript mask validator fails when field is disabled
                    (RC2)
           Product: Struts
           Version: Unknown
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Validator Framework
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


This applies to Struts 1.1 RC2 - no RC2 in bugzilla :(

Hi, After adding the mask validator to an html:text field, the validator failed 
with the following javascript error when the field has been disabled.

"Line 1610
 char: 20
 Error: Can't move focus to the control because it is invisible, not enalbed, 
or of a type that does not accept foucs.
Code: 0
URL: http://localhost:8800/cds/createSchedulePage3Controller.do";

It would appear that the validator is trying to validate the field and then set 
focus to it even though it has been disabled.  Unless it is a requred field, I 
would not want it validated as the user would not have completed its value.

The line of code being referred to is below:

      function validateMask(form) {
         ...
         if (fields.length > 0) {
1610>>       focusField.focus();
             alert(fields.join('\n'));
         }
         return isValid;
      }

I had a play with the javascript in validation-rules.xml and adding the 
following line seems to correct the problem:

function validateMask(form) {
        ...
        var field = form[oMasked[x][0]];

        if ((field.type == 'text' || 
             field.type == 'textarea') && 
             (field.value.length > 0) &&
 >>>         (field.disabled == false)) {

            if (!matchPattern(field.value, oMasked[x][2]("mask"))) {
            ...

Would this be applicable to all JS validation routines, except 
perhaps 'required'.  I know that I would want it on most of the routines.

Thanks, Colin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to