You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by log2akshat <ak...@iiitmk.ac.in> on 2011/07/21 16:20:21 UTC

How to do validation for Single Quote (') through validation.xml file?

Can somebody please tell me how to do validation for Single Quote (') through
validation.xml file?

My problem is that when anybody types in the form field I have set the
javascript with onkeyup event that pops up the error on pressing single
quote as well as for the maximum word limit set. But if anybody is doing
copy pasting then that will not complain and I can also not prevent copy
pasting on my form, I have to set it open. So, is there anyway where I can
validate the Single quote by validation.xml file?

--
View this message in context: http://struts.1045723.n5.nabble.com/How-to-do-validation-for-Single-Quote-through-validation-xml-file-tp4619553p4619553.html
Sent from the Struts - User mailing list archive at Nabble.com.

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


Re: How to do validation for Single Quote (') through validation.xml file?

Posted by Manos Batsis <ma...@geekologue.com>.
On 07/21/2011 08:07 PM, log2akshat wrote:
> I got the Solution:
>
> <field name="Knowing">
>         <field-validator type="regex">
>
>          <message key="validate_appos"/>
>          </field-validator>
> </field>
>
> But how can I escape the ' to display by .properties file in error message.
> I used (\') but its not working.
>
> Please anybody can help me on how to validate the number of words typed on
> click of submit button by validation.xml file.

AFAIK escaping of single-quotes is not required in property files but 
stuff like java.text.MessageFormat - try double apos instead ('')

hth,

Manos

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


Re: How to do validation for Single Quote (') through validation.xml file?

Posted by log2akshat <ak...@iiitmk.ac.in>.
I got the Solution:

<field name="Knowing">
       <field-validator type="regex">
        
        <message key="validate_appos"/>
        </field-validator>
</field>

But how can I escape the ' to display by .properties file in error message.
I used (\') but its not working.

Please anybody can help me on how to validate the number of words typed on
click of submit button by validation.xml file.

--
View this message in context: http://struts.1045723.n5.nabble.com/How-to-do-validation-for-Single-Quote-through-validation-xml-file-tp4619553p4620290.html
Sent from the Struts - User mailing list archive at Nabble.com.

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