how to update variables outside base of mrvs values

flsn2
Tera Expert

Hi 

 

We have a mrvs that calculates taxes.

 

We also have 3 variables outside of the mrvs that calculates the final numbers with an onsubmit client script.

 

This is working okay but our client would like to be able to see the final numbers before sending the request.

 

i've been trying for hours to sort it out but i'm stuck.

 

Any help would be appreciate

 

here is the display

 

flsn2_0-1718196534747.png

 

 

Our current onSubmit script

 

function onSubmit() {
   //Type appropriate comment here, and begin script below
   

   var mrvs = JSON.parse(g_form.getValue('MRVS VARIABLE SET NAME'));

var subtotal = 0;
var totaltax = 0;
var total = 0;

   for (var i = 0; i < mrvs.length; i++){

	subtotal += parseFloat(mrvs[i].line_item_subtotal);
	totaltax += parseFloat(mrvs[i].line_item_total_tax);
	total += parseFloat(mrvs[i].line_item_total);

   }

   g_form.setValue('subtotal', subtotal);
      g_form.setValue('total_tax', totaltax);
	     g_form.setValue('total', total);

return false;
}
0 REPLIES 0