I’m working in Acrobat Pro DC, I’ve created a form and I have the following issue. The form asks about rental income, whether it is monthly or yearly (the format is below).
What I would like to happen, if possible, is if the user clicks the Monthly checkbox (Monthly) the cursor goes to Text 2 and the user enters the monthly amount.
If the user clicks the Yearly checkbox (Yearly), the cursor goes to Text1, the user enters the yearly amount. That amount is automatically divided by 12 and shows in the Text2 text field; and the cursor goes to the next text field, Text3.
Naturally I do not want the user to be able to click both checkboxes, but I’m sure the coding would take care of that, just not sure how to come up with the coding.
Rental Income £ Monthly
£ Yearly, if yes $ Text1 / 12 $ Text2
Thanks for the help.
You have 3 separate issues here:
- Check-box exclusivity
- Jumping to another field
- Calculating the monthly payment
- Check-box exclusivity: You need to give both fields the same name (say "RentalPeriod") but different export values, say "Monthly" and "Yearly".
- Jumping to another field: As the MouseUp event of the "Monthly" box enter this script:
As the MouseUp event of the "Yearly" box enter this script:
- Calculating the monthly payment: So you want this value to be entered by the user if the "Monthly" option is selected, but be calculated if the "Yearly" option is selected? That's a bit tricky to implement in a single field, but you can try using something like this as the custom validation script of "Text1":
if (event.value && this.getField("RentalPeriod").value=="Yearly") this.getField("Text2").value = Number(event.value)/12;
Awesome! This works perfectly. Thank you so much!