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

Need Assistance with JavaScript Code

Community Beginner ,
Apr 18, 2020 Apr 18, 2020

Copy link to clipboard

Copied

Hi,

I am creating a form in which I need assistance creating a JavaScript calculation.

 

Section 1 - I have a section of the form in which there are four (4) fields to enter data for a specific customer:

  1. Name
  2. Address
  3. Phone
  4. Email

There are four areas to enter this information (Customer 1, 2, 3, and 4).

On the next page, in Section 2, there is a similar format requesting the same type information. In some cases, the information being entered may have already been entered for a customer in Section 1. Ordinarily, in MS Word, we would copy and paste, but there is not a way to copy and paste multiple fields for the end user. 

 

I would like to setup a drop down menu with options to automatically prefill in Section 2.

Example: In Section 2, I can select "Customer 2" from the drop down menu and the same data I entered in Section 1 will appear in the fields for Section 2. However, as I previously said, it is possible that the customers being entered in Section 2 would be completely different than Section 1 - so there would need to be some sort of override.

Is this something possible to do? If so, could someone share some kind of code that would do this? I am a beginner when it comes to JavaScript, so I would really appreciate any help.

TOPICS
Acrobat SDK and JavaScript

Views

188

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 ,
Apr 19, 2020 Apr 19, 2020

Copy link to clipboard

Copied

LATEST

I would use a button, not a drop-down field. The text of the button could be something like "Same as Customer 1".

When the user clicks it you copy the values from the fields in section 1 to section 2, or 3, or 4, wherever the button is located.

The user will still be able to manually override those values, but also they wouldn't automatically update if they go back to section 1 and change them, unless they click that button again.

The code is pretty simple. Let's say it's for section 2, copying the values of section 1:

 

this.getField("Name 2").value = this.getField("Name 1").value;

this.getField("Address 2").value = this.getField("Address 1").value;

this.getField("Phone 2").value = this.getField("Phone 1").value;

this.getField("Email 2").value = this.getField("Email 1").value;

Votes

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