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

Checkbox once clicked, populate multiple fields - Javascript

New Here ,
May 18, 2018 May 18, 2018

Copy link to clipboard

Copied

I am trying to make a script where once a checkbox is clicked, it take information from two field, then each populates to it's designated area. And if the checkbox is unchecked, it removes that information. So far, I have a script that can take information from one field to another. I posted the code below.

if (getField("Box1").value=="Yes")

this.getField("profile").value = this.getField("Landmark").value;

if (getField("Box1").value=="Off")

this.getField("profile").value = "";

So how would I attempt this? I posted the code of how I thought it could work below.

if (getField("Box1").value=="Yes")

this.getField("profile").value = this.getField("Landmark").value;

this.getField("main house").value = this.getField("Landmark Price").value;

if (getField("Box1").value=="Off")

this.getField("profile").value = "";

this.getField("main house").value = "";

Basically, when the checkbox is checked, I want field "Landmark" to populate to field "profile" as well have field "Landmark Price" populate to field "main house". Then when the checkbox is unchecked, clear the fields "profile" and "main house".

TOPICS
Acrobat SDK and JavaScript , Windows

Views

556

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

correct answers 1 Correct answer

Community Expert , May 18, 2018 May 18, 2018

Use blocks of commands:

if ( ... ) {

  command 1

  command 2

  ...

}

Votes

Translate

Translate
Community Expert ,
May 18, 2018 May 18, 2018

Copy link to clipboard

Copied

Use blocks of commands:

if ( ... ) {

  command 1

  command 2

  ...

}

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
New Here ,
May 18, 2018 May 18, 2018

Copy link to clipboard

Copied

LATEST

That worked. Thanks!!!

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