These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Script Button can remember previous instance page

libraboy
Registered: Dec 14 2007
Posts: 94

Hi There,

Is there any script where you click button and bring you back where you were left at? Like for example if I was in the page 3 and click the help button after I clicked the help button will bring me all the way to the last page and when I'm done and click back button will bring me to the previous page where I was.

Please advice and thanks for your time.

My Product Information:
LiveCycle Designer, Windows
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi libraboy,

Sure. Look up the goBack method under the App object in the Acrobat JavaScript Reference.

Or even easier, just set the Action for the button to execute a menu item and choose the View-Go-To-Previous-View from the list.

Hope this helps,

Dimitri
WindJack Solutions
www.pdfscripting.com
www.windjack.com
libraboy
Registered: Dec 14 2007
Posts: 94
Hi Dimitri,

Thanks for your reply! I am using LC and I have tried everything and searched this forum but no luck. Are you talking javascript about acroform?

Thanks,
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi libraboy,

Yes, I was referring to AcroForms in Acrobat. I missed your Product information said LiveCycle form because this is in the Acrobat Form category. I'm not sure how to do this in a LiveCycle PDF form, sorry.

Dimitri
WindJack Solutions
www.pdfscripting.com
www.windjack.com
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hello,

as LCD does not include a function to go back to the previous page, you need scripting.

1. Create a form variable "PageNav" under "File > Form Properties > Variables" with the value "null".2. Create a script object "Navigation" with a function named "Pages".
function Pages(PageNumber){// Write the page number to the form variablexfa.form.Form1.variables.PageNav.value = PageNumber;}

3. Create a button on the masterpage and add this script.
This Button is used to jump to the page you came from.
// Read the value of the form variable "PageNav"var PreviousPage = xfa.form.Form1.variables.PageNav.value;// Covert the string to a numberPreviousPage = Number(PreviousPage);// Jump to the page xfa.host.currentPage = PreviousPage -1;

4. For all you buttons you use to jump to different form pages add this script.
// Get the current page number and convert it into a stringvar PageNumber = xfa.layout.page(this).toString();// Call the function from the scriptobject that write the// pagenumber to the form variableNavigation.Pages(PageNumber); // Jump to desired page - This part is different for each button.xfa.host.currentPage = 2;

Voila!

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

libraboy
Registered: Dec 14 2007
Posts: 94
Hi Radz,

can you please be more specific? I am new with LC and don't understand your code. Can you be able to provide me a sample?

Thanks,