Hi Sahil,
I'm 90% sure the problem here is that some more of the special
characters in your large character class need to be escaped out. Thing
is I can't find any details of the syntax for REs in the struts
validator docs so I'm not sure exactly which ones. At a guess I'd
suggest the following:
<var-value>^[a-zA-Z]{1}[a-zA-Z0-9\n\r\ _,;?!;:[EMAIL
PROTECTED]/\\()&$%#*+=\-]*$</var-value>
The character class only matches individual characters so & should not be intere
like that. As long as &, the letters a, m and P and ; are matched then & will
be fine. . is a special character in it's own right so to represent an actual fulstop you
need \. and - is certainly a special character within a character class so it definitely
needs to be escaped. Your RE was also not allowing the space character and depending on
your OS new lines can also use the \r special character so I added \ (slash followed by a
space) and \r to the class.
Bart.
Sahil Gupta wrote:
The current mask that I am using is:
<field property="notes" depends="required,maxlength,mask">
<arg0 key="label.approval.notes"/>
<msg name="mask" key="message.mask.displayname" />
<var>
<var-name>mask</var-name>
<var-value>^[a-zA-Z]{1}[a-zA-Z0-9\n_,;?!;:[EMAIL PROTECTED]/\\()&$%#*+=
-]*$</var-value>
</var>
<arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
<var>
<var-name>maxlength</var-name>
<var-value>250</var-value>
</var>
</field>
And if I input some text and along with that I press the Enter Key I get
Validation Error message that I have mentioned in my
ApplicationResources.properties file.
Eg: In the text box I gave the following:
Recommended (and then pressed enter)
And Verified.
When I entered the above text in the Text Box it gave the validation error
message.
Regards,
Sahil Gupta
Extn : 233
Email : [EMAIL PROTECTED]
******************************************************************
NetEdge Computing Global Solutions Private Limited.
A-14, Sector-7, NOIDA U.P. 201-301
Tel # 91-120-2423281, 2423282
Fax # 91-120-2423279
URL http//www.netedgecomputing.com
******************************************************************
This message may contain confidential and/or privileged information. If you
are not the addressee or authorized to receive this for the addressee, you
must not use, copy, disclose or take any action based on this message or any
information herein. If you have received this message in error, please
advise the sender immediately by reply e-mail and delete this message. Thank
you for your cooperation.
-----Original Message-----
From: Bart Busschots [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 30, 2006 4:05 PM
To: Struts Users Mailing List
Subject: Re: Struts Validation
Can you show me the current version of your mask and a sample of an input it
is rejecting?
Bart.
Sahil Gupta wrote:
Thanks Bart,
Yes, what you said was right, so I have changed \ to \\ to match \.
But still I am unable to allow \n in my Validation.
Regards,
Sahil Gupta
-----Original Message-----
From: Bart Busschots [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 30, 2006 3:39 PM
To: Struts Users Mailing List
Subject: Re: Struts Validation
OK, so your Regular expression is trying to match everything between
the start (^) and the end ($) of your input and no where in it do you
allow a new line character, hence it is failing. You need to allow \n
in which ever part of the RE you are happy to have new lines appear in.
At a guess I'd say you probably want them in the second character
class. What I do also notice is that you seem to have some un-escaped
special characters in your second character class. The most obvious one
is a single \, that will not match \, to match \ you need \\.
Hope that helps,
Bart.
Sahil Gupta wrote:
Here is an example of the mask that I am using.
<field property="notes" depends="mask,maxlength">
<arg0 key="label.approval.notes"/>
<msg name="mask"
key="message.mask.displayname" />
<var>
<var-name>mask</var-name>
<var-value>^[a-zA-Z]{1}[a-zA-Z0-9_,;?!;:[EMAIL PROTECTED]/\()&$%#*+=
-]*$</var-value>
</var>
<arg1 name="maxlength" key="${var:maxlength}"
resource="false"/>
<var>
<var-name>maxlength</var-name>
<var-value>250</var-value>
</var>
</field>
Regards,
Sahil Gupta
-----Original Message-----
From: Bart Busschots [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 30, 2006 2:54 PM
To: Struts Users Mailing List
Subject: Re: Struts Validation
Can you show us the mask you currently use and then we will have a
better chance of being able to help.
Bart.
Sahil Gupta wrote:
Hi,
I have used Masking in Validations. I have a text area in which I
have only restricted some special characters. But still if I press
Enter while adding some text there I get an error message.
Can anyone tell me how to allow ENTER in mask.
Thanks
Regards,
Sahil Gupta
Extn : 233
Email : [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
******************************************************************
NetEdge Computing Global Solutions Private Limited.
A-14, Sector-7, NOIDA U.P. 201-301
Tel # 91-120-2423281, 2423282
Fax # 91-120-2423279
URL http//www.netedgecomputing.com
******************************************************************
This message may contain confidential and/or privileged information.
If you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose or take any action based
on this message or any information herein. If you have received this
message in error, please advise the sender immediately by reply
e-mail and delete this message. Thank you for your cooperation.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]