You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2004/06/11 22:34:53 UTC

DO NOT REPLY [Bug 29530] New: - Format functionality for
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=29530>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=29530

Format functionality for <html:text and <property-name of <form-bean

           Summary: Format functionality for <html:text and <property-name
                    of <form-bean
           Product: Struts
           Version: Nightly Build
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Custom Tags
        AssignedTo: dev@struts.apache.org
        ReportedBy: live216@yahoo.com


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"

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