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=32760>. 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=32760 Summary: validWhen does not handle strings correctly: js error Product: Struts Version: 1.2.4 Platform: PC OS/Version: Windows XP Status: NEW Severity: major Priority: P2 Component: Validator Framework AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Using a quoted string with validWhen should work (according to docs, either single or double-quoted strings are valid). What happens is the JS created by the validator is prematurely terminated by the quote, causing a "missing ) after argument list" error. validation.xml fragment: <field property="cardnumber" depends="creditCard,validwhen"> <arg0 key="register.jsp.ccnum" /> <var> <var-name>test</var-name> <var-value>(paymenttype=="cash") or (*this* != null))</var-value> </var> </field> The resultant js looks like: function registrationForm_creditCard () { this.a0 = new Array("cardnumber", "Card Number is an invalid credit card number.", new Function ("varName", "this.test='(paymenttype=="cash") or (*this* != null))'; return this[varName];")); } The quotes need to be escaped (\"). However, attempting to escape them in the validation.xml: <var-value>(paymenttype==\"cash\") or (*this* != null))</var-value> ...results in: Error: missing ) after argument list Source Code: this.a0 = new Array("cardnumber", "Card Number is an invalid credit card number.", new Function ("varName", "this.test='(paymenttype==\\"cash\\") or (*this* != null))'; return this[varName];")); -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]