Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Auto Generate Number once form is submitted

New Here ,
Jan 12, 2016 Jan 12, 2016

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

TOPICS
Acrobat SDK and JavaScript
969
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 14, 2016 Jan 14, 2016

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...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 26, 2016 Jan 26, 2016

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 26, 2016 Jan 26, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 26, 2016 Jan 26, 2016

if (global.count == null) {

global.count = 1

global.setPersistent("count",true)

}

else

global.count++

var f = this.getField("ROS Number")

f.value = global.count

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 26, 2016 Jan 26, 2016

I placed this script under the "Action" tab.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 26, 2016 Jan 26, 2016

What "Action"? You should place it as a doc-level script, via Tools - JavaScript - Document JavaScripts.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 28, 2016 Jan 28, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 28, 2016 Jan 28, 2016

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...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 28, 2016 Jan 28, 2016

That is what I was afraid of. What do you recommend of doing?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 28, 2016 Jan 28, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 04, 2016 Feb 04, 2016
LATEST

Thank you so much!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines