[ https://issues.apache.org/struts/browse/STR-2092?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Benedict closed STR-2092.
------------------------------
Resolution: Won't Fix
Assignee: (was: Struts Developers)
Your validation rules should be able to accept and valid user-interface representation of a value. It's then up to your Action to do the appropriate conversions.
> [taglib] Format functionality for <html:text and <property-name of <form-bean
> -----------------------------------------------------------------------------
>
> Key: STR-2092
> URL: https://issues.apache.org/struts/browse/STR-2092
> Project: Struts 1
> Issue Type: Improvement
> Components: Taglibs
> Affects Versions: Nightly Build
> Environment: Operating System: All
> Platform: All
> Reporter: Hans
> Priority: Minor
>
> Suppose the following problem: A text input field on an html form is to be used
> to input a dollar amount. The user might input this amount as 100,000.55, which
> is a String. But we want the validator to receive a double, but back on the
> html form we want this formated as a dollar amount.
> Functionality should be added to support this type of behavior.
> Proposed solution:
> 1. The <html:text> and other <html> tags should include a format property that
> functions the same the format property of <bean:write>
> 2. The <form-property> of <form-bean> should include a format or regexp
> property, so that input can be formatted before it is handed off to the
> validator. For example, <form-property name="dollar_amt"
> type="java.lang.Double" regexp="XXX"> where XXX is a regular expression to
> remove commas. Thus, by the time the validator got value for dollar_amt, the
> commas would already be removed.
> This way you would have round trip formatting. A value entered as "100,000.55"
> could be regexp to "100000.55", converted to a Double, handed to the validator
> as a Double, and then when it is populated on the html form could be formatted
> back to the dollar amount "100,000.55"
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.