5 Replies Latest reply on Sep 16, 2007 3:51 PM by kglad

    math concatenating stings and numbers?

    TheMadMax
      I am creating a fairly basic calculator that calculate stock option values and percentages etc,

      I am having no problems changing a text field to a number and performing basic math but what I like to know is how to make it a little more dynamic.

      I have three input textfields:

      Number of options:
      Grant Price:
      Current stock price:

      Then I've created a slider that the user can then increase/decrease the projected stock gain percentage from a range of -100 to 100 percent.

      The results are four dynamic textfields that display the following results.

      Project stock price:
      Total stock value:
      Total exercise cost:
      Total options value:

      Current everything works fine but here is where I want to be more dynamic. I would like when the user inputs their values the inputs textfields update to include "$" "," and decimal points were applicable.

      For example:
      Number of options: user enters 10000 - field updates to 10,000.
      Grant Price: user enters 25.50 - field updates to $25.50
      Current stock price: user enters 30.75 - field updates to $30.75

      Then the results would be displayed as follows.
      (my math is not accurate)

      Project stock price: $35.25
      Total stock value: $375,250.25
      Total exercise cost: $250,250.00
      Total options value: $150,750.50

      To sum it up how do I keep the math working and concatenate the "$" "," "." into my numbers?

      Any help with this would be greatly appreciated.