calculate fields in an ADDT form?

Any tips and tricks that has to with the ADDT that doesn't fit into one of the other categories
antonio
Posts: 77
Joined: 2010-09-28 11:48

calculate fields in an ADDT form?

Post by antonio » 2012-11-07 14:38

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

antonio
Posts: 77
Joined: 2010-09-28 11:48

Re: calculate fields in an ADDT form?

Post by antonio » 2012-11-09 14:35

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

Post Reply