Skip to main content
October 13, 2008
Question

How to add comma and dollar sign that places automatically in input text field

  • October 13, 2008
  • 1 reply
  • 938 views
I have this ROI calculator which has several text input field on frame one with calculate and reset buttons. When a user enters numerical values in the text field, and jumping to the next field, I want the input text filed be updated with dollar sign and with comma.

Next when they hit "ENTER" key or click "Calculate ROI" button, all the input text fields on frame 2 as a result of calculations be updated with dollar sign and comma. I also need that once the comma sign is assigned then it would not add any more even if user presses the button. Can someone help me in this?
This topic has been closed for replies.

1 reply

Inspiring
October 13, 2008
If you want to Set the Comma when you Switch to next Text Field

Use onKillFocus / onSetFocus Functions.

to restrict multiple comma, Before Adding comma use

myText.text = myText.text.split(",").join("").split("$").join("");

So this will give you the value without Comma and Dollar symbol, Now add the Comma and dollar.

or you need to use a Flag for onChange Event.
October 24, 2008
Devendran,

Thanks for your respond. Could you please provide me onKillFocus/onSetFocus function code? Also how do I make addition of decimal values? say, I want to pull data from xml file which has some decimal values and I want to make addition to get an new value in my text field. In simple, what is the code to calculate (addition) decimal value? Once again thanks for your response.