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

http://issues.apache.org/bugzilla/show_bug.cgi?id=30873

Struts Validation - Client Side URL validation fails when using regular expression

           Summary: Struts Validation - Client Side URL validation fails
                    when using regular expression
           Product: Struts
           Version: 1.1 Final
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Validator Framework
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I have the following validation in validation.xml:

    <field property="awardedGrantsUrl" depends="mask,maxlength">
        <msg name="mask" 
key="applicationissuanceform.awardedGrantsUrlFormatMessage"/>
      <arg0 key="applicationissuanceform.awardedGrantsUrl"/>
      <var><var-name>mask</var-name><var-value>^http://([\w-]+\.)+[\w-]*(/[\w-
 ./?%=]*)?$</var-value></var>
      <arg1 key="${var:maxlength}" resource="false" />
      <var>
      <var-name>maxlength</var-name>
      <var-value>2000</var-value>
      </var>
    </field>

this works fine for server side validation, but when I enable client-side, it 
causes a Javascript error which essentially disables all other JS validations 
on the form.  The error shown by Mozilla is:

Error: illegal character
Source File: http://localhost:8080/prpse/admin/addApplicationView.do
Line: 302, Column: 44
Source Code:
this.maxlength='2000'; this.mask=/^http://([\w-]+\.)+[\w-]*(/[\w- ./?%=]*)?$/;  
return this[varName];

and the offending, Struts-generated js line in the HTML is:


     this.am = new Array("awardedGrantsUrl", "Awarded Grants or Awarded 
Contracts URL. can not be greater than 2000 characters.", new Function 
("varName", "this.maxlength='2000'; this.mask=/^http://([\\w-]+\\.)+[\\w-]*(/
[\\w- ./?%=]*)?$/;  return this[varName];"));


thank you

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

Reply via email to