Sum/Total Catalog Item Variable Values

Melissa Berry
Tera Guru

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);
 
}

1 ACCEPTED SOLUTION

Carl Fransen1
Tera Guru

Hi Melissa,

I used this link to find how to do it, works well.  Another great article by Nathan and NewRocket.

 

Cheers

Carl.

View solution in original post

2 REPLIES 2

Carl Fransen1
Tera Guru

Hi Melissa,

I used this link to find how to do it, works well.  Another great article by Nathan and NewRocket.

 

Cheers

Carl.

Melissa Berry
Tera Guru

This worked! thank you very much.