JavaScript Copying value from one text field to another

New Here ,
Oct 02, 2018 Oct 02, 2018

Copy link to clipboard

Copied

I have created a button to run the following actions:

  1. Mouse Down > Execute a menu item > File>Print...
  2. Mouse Down > Run a JavaScript as follows

                                                  function copyToAnother()

                                                  {

                                                  var text1 = document.getElementById(id_of_first_text_field);

                                                  var text2 =document.getElementById(id_of_second_text_field);

                                                  text2.value = text1.value; // copy value of Ist field into second Field

                                                  }

        This is to try to copy a numerical vale from a text field (Text1) to another text field (Text2)

     3. Mouse Down > Reset a form (all fields except Text2)

     4.  I then want to use a JavaScript to autosave the form

     5.  When this saved file is opened, I  want to use a JavaScript to move the value from the Text2 field to the Text1 field

I would like to do this with using a global object for sequential numbering.  So far, my JavaScript doesn't seem to produce results.  Is there an easier way to accomplish the above tasks?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

75

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
Most Valuable Participant ,
Oct 02, 2018 Oct 02, 2018

Copy link to clipboard

Copied

LATEST

2. getElementById is used in browser JavaScript, not in Acrobat JavaScript.

2. This is a function, you would need to call it (though it won't work)

Autosave is a serious problem, because you can download PDF files from the internet - they are not free to just save where they want.

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