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

Limit number of times a button spawns a document -Javacript

New Here ,
Mar 02, 2018 Mar 02, 2018

I am working on an inventory list that is 2 pages. The second page I want to be optional so I decided to use JavaScript (for spawning). I applied this script to my button and it does work. My issue is I only want it to spawn the document once. At this time the button spawns the same document multiple times.

var expTplt = getTemplate("P0Inventorylist");

expTplt.spawn(numPages,false,false);

I only want the user to be able to pull this one time if additional lines are needed. What is the coding I would add to the one above that will limit the user to only pulling this one time?

TOPICS
Acrobat SDK and JavaScript , Windows
391
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

correct answers 1 Correct answer

Community Expert , Mar 02, 2018 Mar 02, 2018

Add this to the end of the code:

event.target.display = display.hidden;
If the button is on the page that is getting spawned then add a command to hide the spawned copy, as well, like this:

this.getField("Name of spawned button").display = display.hidden;

Translate
Community Expert ,
Mar 02, 2018 Mar 02, 2018

Add this to the end of the code:

event.target.display = display.hidden;
If the button is on the page that is getting spawned then add a command to hide the spawned copy, as well, like this:

this.getField("Name of spawned button").display = display.hidden;

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 ,
Mar 02, 2018 Mar 02, 2018
LATEST

Thanks for this. It worked like a charm!

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