At 4:20 PM -0800 3/15/05, John Smith wrote:
I have one question regarding to struts validation for French input characters.

I have some input fields in the form to accept the French character input, such as Street name,
person's name,


In struts's validation.xml file, I have defined the following rule:


<global> <constant> <constant-name>streetName</constant-name> <!-- French version --> |<constant-value>^\w+$</constant-value> </constant> </global>

<global>
<constant>
<constant-name>personName</constant-name>
<!-- French version -->
<constant-value>^\w+$</constant-value>
</constant>
</global>



<field property="streetName" depends="requiredif,mask">
<msg name="mask" key="form.addSite.caption.streetName.maskmsg" />
<arg0 key="form.addSite.caption.streetName" />
<var-name>mask</var-name>
<var-value>${streetName}</var-value>
</var>
</field>

.......
When I do the testing and enter the French characters for the streetName which contain French characters, such as, D�SAUTELS, the struts complain about the invalid street name because of special French charactor �,
in fact the street name: D�SAUTELS is a real street name,


My question is how to define the validation rule to include that French character into the <constantvalue>^\w+$</constant-value>, according to regular expression, \w+ should include the French charactor, but it is not?

Do I miss something? How to tell struts validator to include the French locale for input validation purpose? Do I need to set locale for the formset tag inside the validation.xml file

It may be a real street name, but that doesn't mean that '�' is a legitimate word character. Even in English, some street names include spaces and other punctuation. For example, there's a street here in Chicago called "Bryn Mawr". It would fail your streetName test. So would any French word beginning with [L']


You just need to write a more inclusive regular expression.

Joe

--
Joe Germuska
[EMAIL PROTECTED]
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction"  -The Ex

Reply via email to