Dave Newton wrote:
On Fri, 2003-04-04 at 10:16, Wendy Smoak wrote:

but I know my users will want to enter 5,000 or $5,000 or 5000.00 instead of
just 5000.


Worse, if it's an I18N app; using "," for the decimal point for example.


Suggestions please? I didn't get any answers from struts-user, so I'm
thinking I need to write a custom validator for this.


I'd poke around for currency validators in any language (preferably
java, of course) and wrap it up in a custom just like you are already
thinking.

Yes, and also there must be dozens of JavaScript currency validators and you can just use one of these in your JSP/output -- set an onBlur event handler to change it to the "neutral" form if the user tabs or clicks outside the field. This will notify your users that they can just enter 5000 instead of all the extra jazz.


So as not to rely exclusively on JavaScript, which can be disabled, in your CustomValidator implementation you might want to consider using NumberFormat.getCurrencyInstance() and parsing the string with that....


Erik



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



Reply via email to