Skip to main content
Known Participant
October 1, 2024
Answered

Clear form with reset button & clear fields

  • October 1, 2024
  • 2 replies
  • 2288 views

I have a form in Acrobat pro that when the checkboxes are engaged, it populates text elsewhere in my document. I created a reset button that will clear the checkboxes, but it does not also undo the text where it is programmed to appear. However, if I manually uncheck the box, it does unpopulate in the designated area assigned. Can the Reset button do this so I do not have to check then uncheck the checkbox manually?

This topic has been closed for replies.
Correct answer PDF Automation Station

Your reset button would also have to reset field "5".  I assume the script is a Mouse Up action.  It only runs when the check box is clicked, not when it is reset.  Alternatively you can populate the text field using a custom calculation script in the text field instead:

var cText=".Text is placed here that populates elsewhere."'

this.getField("CheckBox").value=="Off"?event.value="":event.value=cText;

The difference is you won't be able to change the text field value because it will always revert to the calculated value.  It will display "" when the text field is reset, however.  These articles might help you:

https://pdfautomationstation.substack.com/p/pdf-form-reset-tricks

https://pdfautomationstation.substack.com/p/calculation-vs-validation-scripts

https://pdfautomationstation.substack.com/p/calculation-vs-validation-scripts-eb5

 

2 replies

PDF Automation Station
Community Expert
Community Expert
October 1, 2024

Can you provide an example of the script that populates text for one of the check boxes and where the script is located?

Known Participant
October 1, 2024

Thank you so much for your assistance. I have uploaded where the checkboxes are located and where they populate. Please let me know if the screenshots make sense. 

 

I have the following script on each checkbox:

var cText = "• Text is placed here that populates elsewhere.";

this.getField("5").value = (event.target.value == "Off")? "" : cText;

PDF Automation Station
Community Expert
Community Expert
October 1, 2024

Your reset button would also have to reset field "5".  I assume the script is a Mouse Up action.  It only runs when the check box is clicked, not when it is reset.  Alternatively you can populate the text field using a custom calculation script in the text field instead:

var cText=".Text is placed here that populates elsewhere."'

this.getField("CheckBox").value=="Off"?event.value="":event.value=cText;

The difference is you won't be able to change the text field value because it will always revert to the calculated value.  It will display "" when the text field is reset, however.  These articles might help you:

https://pdfautomationstation.substack.com/p/pdf-form-reset-tricks

https://pdfautomationstation.substack.com/p/calculation-vs-validation-scripts

https://pdfautomationstation.substack.com/p/calculation-vs-validation-scripts-eb5

 

try67
Community Expert
Community Expert
October 1, 2024

It should. How did you set up the reset button, though? What action does it perform?

Known Participant
October 1, 2024

Thank you for your help!

I set up a Mouse up as the trigger and Reset a form as the action. 

Next, I indicated the checkbox names it applies to then saved. 

The action perfoms correctly, but if I reset the selections using the button, it does not unselect the items that are populating elsewhere within my document. 

try67
Community Expert
Community Expert
October 1, 2024

Did you rename any fields after selecting them for the Reset command?

Can you share the file?