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

Community Beginner ,
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, Create PDFs, How to, PDF forms

Views

47

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

correct answers 1 Correct Answer

Most Valuable Participant , Nov 19, 2020 Nov 19, 2020
And change these lines: if (event.target.value = 1) { To: if (event.value == "1") {

Likes

Translate

Translate
Adobe Community Professional ,
Nov 19, 2020 Nov 19, 2020

Copy link to clipboard

Copied

You should use a validation script at the dropdown list.

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 Beginner ,
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. 

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 ,
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") {

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