- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 01:13 PM
I have 3 variables on a catalog item that users can input numbers into.
I am trying to sum them and input the total value into another variable as they input the values, but I cant get it to calculate.
function onChange() {
var sathours = g_form.getValue('saturday_hours');
var sunhours = g_form.getValue('sunday_hours');
var monhours = g_form.getValue('monday_hours');
var total = Number(sathours) + Number(sunhours) + Number(monhours);
g_form.setValue('total_hours',total);
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 02:30 PM
Hi Melissa,
I used this link to find how to do it, works well. Another great article by Nathan and NewRocket.
Cheers
Carl.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 02:30 PM
Hi Melissa,
I used this link to find how to do it, works well. Another great article by Nathan and NewRocket.
Cheers
Carl.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2018 09:56 AM
This worked! thank you very much.