[ http://issues.apache.org/jira/browse/TAPESTRY-137?page=all ]
     
Jesse Kuhnert resolved TAPESTRY-137:
------------------------------------

    Fix Version: 4.0.1
     Resolution: Fixed
      Assign To:     (was: Tapestry Developer List)

> NumberValidator's error messages are localized, but parsing/formatting is not
> -----------------------------------------------------------------------------
>
>          Key: TAPESTRY-137
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-137
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 3.0
>  Environment: Operating System: Windows XP
> Platform: PC
>     Reporter: Davide Orlandi
>      Fix For: 4.0.1

>
> Error messages from NumberValidator are formatted using locale settings 
> (since 
> they are built from MessageFormat.format()) but parsing and formatting is not.
> So, for example, if the minimum value constraint is set to 12345, an user 
> typing "5000" in a ValidField would get this error:
> "test numeric field must not be smaller than 12,345."
> And typing "12,345" (pasting exactly from the error message) he would get:
> "test numeric field must be a numeric value."
> This can be quite misleading for users, especially in non-english locales: an 
> italian ResourceBundle of ValidationStrings would display 12345 as "12.345" 
> (yes, with the dot -- stupid locale rules :(  ).
> Solutions: NumberValidator should format/parse using a localized NumberFormat 
> (not so easy) or (easier) minimum and maximum should be toString()ed before 
> passing them to formatString().
> Tested code (using Tapestry 3.0 beta 4 and Tomcat 5.0.18):
> --- Home.page ---
> <page-specification class="org.apache.tapestry.html.BasePage">
>     <property-specification name="numericValue" type="java.lang.Integer" />
>     <bean name="validator" class="org.apache.tapestry.valid.NumberValidator">
>         <set-property name="minimum" expression="12345" />
>     </bean>
>     <bean name="delegate" 
> class="org.apache.tapestry.valid.ValidationDelegate" />
> </page-specification>
> --- Home.html ---
> <html><body>
>     <div jwcid="@Delegator" delegate="ognl:beans.delegate.firstError" />
>     <form jwcid="@Form" delegate="ognl:beans.delegate">
>         <input jwcid="@ValidField" validator="ognl:beans.validator"
>             displayName="test numeric field" value="ognl:numericValue" />
>         <input jwcid="@Submit" />
>     </form>
> </body></html>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to