Copy link to clipboard
Copied
Hello,
I don't know anything about javascript and need some help. I have a photography contract that I'd like to offer a "bundle discount" of $50 when two services are going to be used. Service 1 is "Photography Coverage" and Service 2 is "Photo Booth Rental".
Text Field 1 = Subtotal (this calculates the radio button and checkbox values)
Text Field 2 = Discount (This is where I need help. I'd like this to auto-populate with $50 when my two default radio buttons are un-selected. But only when BOTH are un-selected)
Text Field 3 = Total (This has a basic calculation of Subtotal-Discount)
The two default services (that I purposely have checked from the start) are both set to values of "0" so the Subtotal stays at $0. If the customer is only going to use ONE service (meaning one of the default selections will remain selected), then there will be no discount, but if they decide to use both photography and the booth, they save $50.
Can someone please help me write a calculation script for the Discount Text Field, to accomplish what I'm asking?
You can use something like this as the custom calculation script of the discount field:
event.value = (this.getField("Service1").value==0 || this.getField("Service2").value==0) ? 0 : 50;
Just adjust the field names in the code to match the actual ones in your file.
Copy link to clipboard
Copied
You can use something like this as the custom calculation script of the discount field:
event.value = (this.getField("Service1").value==0 || this.getField("Service2").value==0) ? 0 : 50;
Just adjust the field names in the code to match the actual ones in your file.
Copy link to clipboard
Copied
Wow, worked like a charm! Thanks so much for the quick reply and your knowledge. Java is not my friend on the coding end, but I do love the capabilities!
Copy link to clipboard
Copied
This is actually JavaScript, not Java. Similar names, quite different languages.
Copy link to clipboard
Copied
Ah got it, I always thought Java was just short for JavaScript... shows how much I know. Thanks again!
Copy link to clipboard
Copied
Don't beat yourself up too much. It's a very common mistake...
On Fri, May 27, 2016 at 12:45 AM, abrownphoto <forums_noreply@adobe.com>
Find more inspiration, events, and resources on the new Adobe Community
Explore Now