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

Help w/ pulling data from one textbox to another textbox based on a separate dropdown box/value.

Explorer ,
Nov 19, 2020 Nov 19, 2020

Copy link to clipboard

Copied

I apologize in advance if this is confusing. 

 

So I have a dropdown ("dh1ZoneDD") - with options: 1, 2, 3, 4

I have a textbox ("z1GPP1") that will receive/display the info based on the selection of the DD.

And I have 4 textboxes that will have some calculated data (we can call these "GPP1", "GPP2", "GPP3", "GPP4") if the dropdown selection is 1 - "z1GPP1" will display the value that is in "GPP1".

 

I've tried a few approaches when it comes to coding this solution and I can't get it to work beyond displaying the first value from GPP1 when the DD choice is 1. Any bit of help is greatly appreciated!

 

<This Code is placed in "z1GPP1">

var z1 = this.getField("z1GPP1").value;
var z2 = this.getField("z2GPP1").value;
var z3 = this.getField("z3GPP1").value;
var z4 = this.getField("z4GPP1").value;

if (event.target.value = 1) {
    this.getField("dh1ZoneGPP1").value = z1;
} else if (event.target.value = 2) {
    this.getField("dh1ZoneGPP1").value = z2;
} else if (event.target.value = 3) {
    this.getField("dh1ZoneGPP1").value = z3;
} else if (event.target.value = 4) {
    this.getField("dh1ZoneGPP1").value = z4;
}
TOPICS
Acrobat SDK and JavaScript

Views

375

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

And change these lines:

if (event.target.value = 1) {

To:

if (event.value == "1") {

Votes

Translate

Translate
Community Expert ,
Nov 19, 2020 Nov 19, 2020

Copy link to clipboard

Copied

You should use a validation script at the dropdown list.

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
Explorer ,
Nov 19, 2020 Nov 19, 2020

Copy link to clipboard

Copied

Would I use similar code for that? 

 

I've never used a validation script before. I'll look up the documentation on it. 

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
Community Expert ,
Nov 19, 2020 Nov 19, 2020

Copy link to clipboard

Copied

LATEST

And change these lines:

if (event.target.value = 1) {

To:

if (event.value == "1") {

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