Copy link to clipboard
Copied
I have a plumbing supplies price list which consists of 5 pages of items, each with a check box. These items total into the subtotal field if checked. Now, the client wants a variable that if the purchase is for a model home, there is no charge. I already have a "model home" check box, so I need to find out how to set this up so that if it is checked, the "sub total" field is "0". Is there an easy way to do this?
You can use this code as the custom calculation script for sub-total:
if (this.getField("model home").value!="Off") event.value = 0;
else event.value = Number(this.getField("page 1 total").value) + Number(this.getField("page 2 total").value) + Number(this.getField("page 3 total").value) + Number(this.getField("page 4 total").value) + Number(this.getField("page 5 total").value);
Copy link to clipboard
Copied
Can you post the current code you're using for the calculation of the sub total field?
Basically, adding this line to the end of it should do the trick:
if (this.getField("model home").value!="Off") event.value = 0;
Copy link to clipboard
Copied
Thanks so much for responding so quickly!
I currently am using the "Value is the sum of the following fields" and then I selected my fields page 1 total, page 2 total, page 3 total, page 4 total, page 5 total
Is there a way I can use a custom calculation to do the same thing? I am brand new to Javascript.
Copy link to clipboard
Copied
You can use this code as the custom calculation script for sub-total:
if (this.getField("model home").value!="Off") event.value = 0;
else event.value = Number(this.getField("page 1 total").value) + Number(this.getField("page 2 total").value) + Number(this.getField("page 3 total").value) + Number(this.getField("page 4 total").value) + Number(this.getField("page 5 total").value);
Copy link to clipboard
Copied
That worked! Thank you so much!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now