Stringlength validator xhtml template should be locale independent
------------------------------------------------------------------
Key: WW-2254
URL: https://issues.apache.org/struts/browse/WW-2254
Project: Struts 2
Issue Type: Bug
Components: Views
Affects Versions: 2.0.9
Environment: Firefox 2
Reporter: Max Pimm
Priority: Minor
The freemarker template that generates client side validation for the xhtml
theme (template/xhtml/form-close-validate.ftl) generates the javascript
functions for different validators.
In the case of the stringlength validator there are a series of lines of code
that are generated that may not work in locales that are not English. For
example, if you define the maxLength to be 1000.
value.length > ${validator.maxLength}
in a Spanish locale outputs
value.length > 1,000
Which results in a string comparison rather than a number comparison.
To remedy this i have found two valid solutions.
1) Include number formating for freemarker: ${validator.maxLength?string("#")
2) Add javascript conversion to an int: parseInt(${validator.maxLength)
I have not tested either of these solutions in other browsers.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.