Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

Page Spawning - Prompting For Number Of Pages

$
0
0

I asked a similar question a few years back and at the time, the project went by the wayside.  Well, the project is back on track and now I'm in a jam and need to use some javascript for some easy automation.  Here's the situation.  I have a form with a hidden button that allows persons who know where the button is, to spawn the current semplate into additional pages, while renaming the approzimately 400+ form fields on each page.  As it currently stands, the user needs to click the hidden button each time to spawn a new page.  This is kind of cumbersome considering, I need to generate approximately 200 pages at a time.  Here is the current code (culled from any of a number of web pages) that works for the single click page addition:

 

// Get a template object from an existing template

var t = getTemplate("temp1");

 

 

// Spawn the template on the page following this one, and rename the fields

t.spawn({nPage: pageNum + 1, bRename: true, bOverlay: false});

 

 

 

What I'd like to do is have the button "click" (mouse up) produce a dialog box that asks the user to input the number of pages needed to be spawned.  I'm not concerned about page numbering as I have a separate means for doing that, once all the pages have been spawned.  Clearly, I am not a javascript programmer, so, if someone is willing to help, it's going to have to be usable code that will require only minor tinkering, if any.  Any help or ideas would be greatly appreciated.  I'm using Acrobat Pro X.  There was an MVP named George Johnson who tried to help me back them, but quite honestly, Is imply didn't know how to tie it all together.  He suggested using the following code in generating the dialog box (obviously, text is not geared toward my document).  Can someone show me how to tie all of this together?

 

var cResponse = app.response({

           cQuestion: "How are you today?",

               cTitle: "Your Health Status",

               cDefault: "Fine",

               cLabel: "Response:"

});

if (cResponse == null)

           app.alert("Thanks for trying anyway.");

else

           app.alert("You responded, \""+cResponse+"\", to the health "

                     + "question.",3);

 

 

Thank you in advance,

 

Randy


Viewing all articles
Browse latest Browse all 12130


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>