You could use "restrict" to prevent entry of any non-numeric characters.

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of flexcoder2008
Sent: Tuesday, December 02, 2008 6:51 PM
To: [email protected]
Subject: [flexcoders] Unformatting currency values - best practice?

 

What is the best practice or a good recommendation for formatting
currency values and then removing the currency formatting for saving
to the database?

Here's what I have attempted to do so far. It works - but only if the
user enters plain old numbers - if they add any currency symbol or
thousand separator, it fails.

I have a form which has some textInput's that are formatted with
currencyFormatters. I initialize each textInput's .data property to
"0". The textInput displays formatted currency amounts from xml data
retrieved from the database. On the focusIn event, the text property
is assigned to the textInput's .data property, so the value stays the
same but the formatting is gone. And when a change event fires, the
unformatted text in the textInput gets updated to the data property as
well.

On the FocusOut event, the currency formatting is re-applied.

When I save to the db, I use the textInput's .data property. So for
the most part this works, but fails if the user enters any currency
symbols.

Is there a good class or function someone could recommend to take a
currency value in a textInput and strip out all the extra formatting
characters? I am also trying to implement localization, so the
various currency symbols will be different depending on the locale.

Thanks

 

Reply via email to