Copy link to clipboard
Copied
Hello,
I have 1 checkbox with the name taxable and 2 fields with the name CashPrice and TaxableTotal. And in text1 there is a value.
Now comes my question if i check the checkbox the value of CashPrice needs to be added to the TaxableTotal. There are 8 lines that will needed to be able to be added. I don't know how to begin.
Can someone help me with this script ?
OK, that's better. You can use this code as the custom calculation script of your total field:
var total = 0;
for (var i=1; i<=8; i++) {
if (this.getField("Taxable"+i).value!="Off")
total+=Number(this.getField("CashPrice"+i).value);
}
event.value = total;
Copy link to clipboard
Copied
It's possible, but you need to better explain the situation... Where does "text1" fit into this? What are the names of the 8 fields? Is it 8 pairs of check-boxes and text fields, or something else? Please clarify.
Copy link to clipboard
Copied
I apologize in CashPrice there is a value... text1 doesn't fit in this one that was an accident. It is 8 pairs of check boxes and fields. The check boxes are named Taxable1, Taxable2, Taxable3....Taxable8 the text fields are CashPrice1, CashPrice2....CashPrice8.
This is a form used for a purchase order. My goal is to find the total of the equipment that is taxable, so that I can figure the tax in a later box.
By trial and error and lots of reading I have figured out several of the other scripts that I have used, but this one has stumped me.
Copy link to clipboard
Copied
OK, that's better. You can use this code as the custom calculation script of your total field:
var total = 0;
for (var i=1; i<=8; i++) {
if (this.getField("Taxable"+i).value!="Off")
total+=Number(this.getField("CashPrice"+i).value);
}
event.value = total;
Copy link to clipboard
Copied
You're awesome. Thanks a million!