Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Converting string values into integers and adding them together.


Level 2


I need some help, I'm working with a form where we pull in values into a text field in currency format (ex. $12,345.67).  This form also has some boxes that are user entered, and I need to be able to add the values that we pull in as well as the other user entered values into another "total" field.  It looks like I need to take the string that gets pulled in, and convert it to a raw integer value and then have it add all of the values into another field.  I'm trying to do this with javascript.

any help would be appreciated.


Selling price  (pulled in automatically)

+ add ons (entered by user)

+ additional fee (entered by user)

- rebates (pulled in automatically)

+ taxes (pulled in automaticall)


= total


1 Reply


Level 10


Can you pull in the information without the currency and then use a numeric field (with a currency pattern)? It would be the best approach.

If not, then you will need to strip out all non-numeric characters (except the decimal point).

I can't share a solution we developed for a client, but I can give a direction:

This in the calculate event of the Total field:

var sellPrice, cleanPrice;

if (sellingPrice.rawValue !== null) {

    sellPrice = sellingPrice.rawValue.replace(/[^0-9.]+/g, "");

    cleanPrice = Number(sellPrice);


this.rawValue = cleanPrice;

Hopefully you can extend this,