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

Reset form fields and go to

Participant ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

Hello,

In a PDF form I need to reset form fields via a Reset Button, and after that I need to do a go to label, because reset will clear a few fields that has been populated via a dialog display entry.  I need to go back where the dialog started to get the data again via dialog fields.  Your help and suggestion is appreciated in advance. 

Regards,

Jeff P

TOPICS
Acrobat SDK and JavaScript , Windows

Views

405

Likes

Translate

Translate

Report

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 ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

use this code to put the focus on a specific field

this.getField("TheFieldName").setFocus();

Put this code in a "Run a JavaScript" action on the same button that does the reset.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

Translate

Translate

Report

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
Participant ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

Thanks, but did not worked out... Reset does not work... neither continue, goto, go to etc...

Likes

Translate

Translate

Report

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 ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

Do you mean "go to" as in "go to a line of code in a script and execute from there"? If so, that's not possible with JS, nor is it necessary. You can just call that code once more (assuming it's in a function) after resetting the fields.

Likes

Translate

Translate

Report

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
Participant ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

yes, I want to go back and run the dialog code to get the data, I just don't know how I can fall back to first dialog it was displayed.

Likes

Translate

Translate

Report

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 ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

Put the code that displays the dialog in a function and then call that function.

Likes

Translate

Translate

Report

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 ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

How is this Dialog activated in the first place?

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

Translate

Translate

Report

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
Participant ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

Hi,

clicking on the form first displays the dialog, gets 3-4 fields via dialog then clicking OK button take you to the actual first page of the form that has the button for Reseting etc.   I put your line of code in the action tab removing the Reset form added, Run JavaScript and added your line of code in there... Now reset even stopped working.

Regards,

Jeff P.

Likes

Translate

Translate

Report

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 ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

Clicking anywhere on the form? What event are you using to display the dialog?

Is this a regular Acrobat Form?

I provided code that was to be used in addition to the form reset. Not replacing it.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

Translate

Translate

Report

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
Participant ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

HI,

Not on the form... Just click on the file name "Say i.e. X.pdf"  to open it, pops out the blank page having dialog in the middle entering the fie;ds clicking on OK button goes to the first displayed page of the form.  I am using Adobe Acrobat Pro XI. I tried to add a new step to Run JavaScript on reset button, somehow I noticed can't do that.  When I clicked to add a new step for the Reset button I saw a menu that had everything "Menu Item" except add "Run JavaScript".

Regards,

Jeff P.

Likes

Translate

Translate

Report

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 ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

Ok, so the Dialog code must be in a Document Script? Do you know which line in the script displays the dialog? This is the line you'll need to run.

There should be no problems adding multiple Actions to a MouseUp event on a button. Please try this again.

Why is a blank page displayed? Is this a real page in the PDF?

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

Translate

Translate

Report

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
Participant ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

Hi,

Blank page is not Just a blank pdf page part of the form, dialog appears in center of a blank page and dialog can easily be moved around, or dialog is completely free and independent of blank page... Yes the dialog variable is what is being executed first for collecting the vital and important fields.

At your instruction I tried one more time to add a new step to my Reset Button.

1. Went to the Edit mode of the Form

2. Clicked on the Reset button

3. Opened Property

4. under the Action tab, tried to add a new step under the Reset Form step.

5. I am attaching the menu item was opened for me and I scrolled down and I did not see anything indicating Run JavaScript.

Menu Item.png

Try it do you see any option to Run JavaScript?

Regards.

Jeff P.

Likes

Translate

Translate

Report

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 ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

When you clicked the "Add" button, the "Select Action" was set to "Execute a menu item", so you're adding a menu item action. You need to select different Action types before clicking the Add button.

I'm getting the feeling that you are not the original author of this form. What is your familiarity with JavaScript?

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

Translate

Translate

Report

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 ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

Please post a screen shot of this dialog when it is first displayed.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

Translate

Translate

Report

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
Participant ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

here it is. moved it to top left corner and did screen shot and trimmed it to fit.

Movable Dialog.png

Likes

Translate

Translate

Report

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 ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

LATEST

So this is a custom dialog, I needed to be sure before moving forward. Do you know where the code is for this dialog?

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

Translate

Translate

Report

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