Skip to main content
trevor_b
Participant
May 13, 2020
Question

Help with adding a number by one increment with each instance of "reset button"

  • May 13, 2020
  • 1 reply
  • 1361 views

The answer I found here: 

https://answers.acrobatusers.com/Help-adding-number-increment-instance-reset-button-q96703.aspx 

was beyond my technical knowledge. 

I'd like to know first how to create a form reset button and then have it increment the previous number on save and close.

Where/how do I add the Javascript code?

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
May 13, 2020

Reset button: Add a button with the "Reset Form" command as its Mouse Up action.

Counter field: When do you want to change its value, exactly?

The basic code to do it is:

var f = this.getField("Counter");

f.value = Number(f.value)+1;

f.defaultValue = f.value;

trevor_b
trevor_bAuthor
Participant
May 13, 2020

Try67,

Thanks for your response.

I'm new to Javascript in Acrobat. I composed my form in InDesign including text fields and check boxes.and added a reset button which works well. Where do I add the script in Acrobat?

 

Ideally I would like to increment on save or some other suggestion that would allow me to have a different record each time. 

try67
Community Expert
Community Expert
May 13, 2020

I would use the Will Save event. You can find it under Tools - JavaScript - Set Document Actions.