Copy link to clipboard
Copied
Hello, I'm new to JavaScript for Adobe forms I'm not sure of all the coding or proper terminology. So far I've been doing alright searching the forums for answers, but I can't seem to get this one right.
I have two separate fields with script in them that when the boxes are checked it calculates the savings for the customer. One is for how much they would have saved if they where members and the other is how much they are saving because they are members. It's 20% difference for members and none members.
I would like to put all of the script into one field to run the calculations. When I try to combine them only one check box will work the other doesn't.
The two fields and scripts are
SmileyClubSavings
if (this.getField("RepairFee").isBoxChecked(0)=="1"){event.value=this.getField("Price").value*0.2;} else event.value = 0;
Subtract
if (this.getField("SmileyClubDiscount").isBoxChecked(0)=="1"){event.value=this.getField("SmileyClub").value-this.getField("Price").value;} else event.value = 0;
Working with Adobe Acrobat Pro DC
Copy link to clipboard
Copied
Hello, I'm new to JavaScript for Adobe forms I'm not sure of all the coding or proper terminology. So far I've been doing alright searching the forums for answers, but I can't seem to get this one right.
I have two separate fields with script in them that when the boxes are checked it calculates the savings for the customer. One is for how much they would have saved if they where members and the other is how much they are saving because they are members. It's 20% difference for members and none members.
I would like to put all of the script into one field to run the calculations. When I try to combine them only one check box will work the other doesn't.
The two fields and scripts are
SmileyClubSavings
if (this.getField("RepairFee").isBoxChecked(0)=="1"){event.value=this.getField("Price").value*0.2;} else event.value = 0;
Subtract
if (this.getField("SmileyClubDiscount").isBoxChecked(0)=="1"){event.value=this.getField("SmileyClub").value-this.getField("Price").value;} else event.value = 0;
Working with Adobe Acrobat Pro DC
Copy link to clipboard
Copied
What happens when both boxes are checked?
Copy link to clipboard
Copied
Sorry for delay in responding. I'm part time and work every other day.
When both boxes are checked they still calculate an answer. One is for 20% off original price and the other calculates 80% back to the discounted price. But only one box will be checked at a time. I'm just trying to put both final calculations into one field. Right now I have one field on top of the other.
If I put the code for SmileyClubSavings and Subtract in the Custom calculation script field only the the code for Subtract works. I'm not sure of how to join the two.