You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rod Morris <ro...@gmail.com> on 2005/05/26 18:14:46 UTC

Validator, JavaScript, Quotation Mark

Hello to all you gurus out there.

I'm attempting to use the validator to prevent users from entering a 
quotation mark into a form field with the following mask: ^[^"]*$

The problem I'm running into is this...it works great on the server-side but 
it's breakng my client-side JavaScript validation because it fails to escape 
the quotation marks with a backslash. 

I checked the code for the 
org.apache.struts.taglib.html.JavaScriptValidatorTag and it appears that 
it's only escaping backslash characters (which prevents me from escaping it 
myself). 

I suppose I could customize the JavascriptValidatorTag to get the desired 
behavior but I really don't wish to branch from the standard for something 
as minor as this. Is there configuration setting or a mask that will allow 
me to get the behavior I would like without having to customize the jar 
file?

Sincerely and many thanks,

Rodney Morris
rodney.w.morris@gmail.com

Re: Validator, JavaScript, Quotation Mark

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
Bug 33238 covered this and was fixed in Struts 1.2.7

http://struts.apache.org/userGuide/release-notes.html
http://issues.apache.org/bugzilla/show_bug.cgi?id=33238
http://svn.apache.org/dist/struts/v1.2.7/

Niall

----- Original Message ----- 
From: "Rod Morris" <ro...@gmail.com>
Sent: Thursday, May 26, 2005 5:14 PM


Hello to all you gurus out there.

I'm attempting to use the validator to prevent users from entering a
quotation mark into a form field with the following mask: ^[^"]*$

The problem I'm running into is this...it works great on the server-side but
it's breakng my client-side JavaScript validation because it fails to escape
the quotation marks with a backslash.

I checked the code for the
org.apache.struts.taglib.html.JavaScriptValidatorTag and it appears that
it's only escaping backslash characters (which prevents me from escaping it
myself).

I suppose I could customize the JavascriptValidatorTag to get the desired
behavior but I really don't wish to branch from the standard for something
as minor as this. Is there configuration setting or a mask that will allow
me to get the behavior I would like without having to customize the jar
file?



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org