Page 1 of 1

calculate fields in an ADDT form?

Posted: 2012-11-07 14:38
by antonio
Hi all,
I need to add some calculation to a custom form created using ADDT (but it is the same for MX Kollection pro).

I have a custom/simple order form where there area few fields that need calculations.

Example:

qty1
item1_description
item1_price
item1_totalprice

In this case I need to calculate item1_totalprice bu multiplying qty1 and item1_price.

I actually use some javascript to do the calculation but I cannot make it to work.

Here is my JS code:

Code: Select all

function tot() {

var imp1=(document.form1.qty1.value-0)*(document.form1.item1_price.value-0)
document.form1.item1_totalprice.value=imp1
Then in my form I add the onchange"tot()" call to my fields.
But nothing happens.

I have another page that has similar calculations but it works there. I cannot any difference.

Any idea?

TIA

tony

Re: calculate fields in an ADDT form?

Posted: 2012-11-09 14:35
by antonio
Never mind.
I solved it.
There was the form name missing: name="myform" in the form tag.
After adding it, the calculationsworkead as expected.

ciao

tony