Copy link to clipboard
Copied
I have created a form with Adobe XI Pro and was wondering how to get a number to generate on the form once the user has submitted the form. I have already created the submit button. Also, I would like the number to restart at (1) every time on a specific month and date. Is it possible to do in Adobe Pro? If not, Adobe Live Cycle? Thank you
Copy link to clipboard
Copied
It's possible but keep in mind that this number will only be available on that user's form, ie you will get duplicate numbers if multiple people submit it.
Also, it's not clear whether you want to generate this number before or after the file is submitted. At any case, if the user doesn't save the form after you generate the number it will be lost...
Copy link to clipboard
Copied
I would like to generate the number once the form is opened. It is my understanding that it is nearly impossible for it to generate once the form is submitted. Am I correct?
Currently the form generates a number onto the form once the form is opened,however, there has been times once I tab to the next text field, the auto number goes up one. How can I prevent that from happening?
Lastly, is there a way to get the number to start over at 1 at say October 1 of every year?
Copy link to clipboard
Copied
What code are you using, and where did you place it?
It's certainly possible to generate a number once the form is submitted, but what's the point? If you do it like that the number won't be a part of the submitted copy.
Copy link to clipboard
Copied
if (global.count == null) {
global.count = 1
global.setPersistent("count",true)
}
else
global.count++
var f = this.getField("ROS Number")
f.value = global.count
Copy link to clipboard
Copied
I placed this script under the "Action" tab.
Copy link to clipboard
Copied
What "Action"? You should place it as a doc-level script, via Tools - JavaScript - Document JavaScripts.
Copy link to clipboard
Copied
Okay I have done that. Tested it out and it works! Now in order for the number to restart back at one at the beginning of a month, what will I need to do. Thanks.
Copy link to clipboard
Copied
At the doc-level you can add something like this:
if (new Date().getDate()==1) {global.count=1; this.getField("ROS Number")=global.count;}
Keep in mind, though, that if the file is opened multiple times on the same day it will reset it over and over...
Copy link to clipboard
Copied
That is what I was afraid of. What do you recommend of doing?
Copy link to clipboard
Copied
There's no simple solution. I guess you could save the dates in which the form was reset into a global variable, and then use it to check if the file was already reset on that date. If it was then don't do it again. If it wasn't then reset it and add the current date to the variable.
Copy link to clipboard
Copied
Thank you so much!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now