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

populate fields from other fields if checkbox checked.

Participant ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

On page 1 I have an address box... City, Province, Postal code, street address

On page 2, if user checks box, the fields from Page 1 populate the address box on page 2

I put this JS in the MouseUp of the checkbox

When I check the box, in the fields on Page 1, the field text is replaced with [object Field]

I found this on this forum,

Checkbox is named sameaddress. The fields with the 2 are the fields on Page to, to get the text from Page1

if (getField("sameaddress").value!="Off")

this.getField("StreetAddress").value = this.getField("StreetAddress2");

this.getField("City").value = this.getField("City2");

this.getField("Province").value = this.getField("Province2");

this.getField("PostalCode").value = this.getField("PostalCode2");

TOPICS
Acrobat SDK and JavaScript , Windows

Views

528

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 , Sep 22, 2017 Sep 22, 2017

You have several problems in your code. Use this:

if (event.target.value!="Off") {

    this.getField("StreetAddress").value = this.getField("StreetAddress2").value;

    this.getField("City").value = this.getField("City2").value;

    this.getField("Province").value = this.getField("Province2").value;

    this.getField("PostalCode").value = this.getField("PostalCode2").value;

}

Votes

Translate

Translate
Community Expert ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

You have several problems in your code. Use this:

if (event.target.value!="Off") {

    this.getField("StreetAddress").value = this.getField("StreetAddress2").value;

    this.getField("City").value = this.getField("City2").value;

    this.getField("Province").value = this.getField("Province2").value;

    this.getField("PostalCode").value = this.getField("PostalCode2").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
Participant ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

LATEST

Perfect, and I see my errors. I want a target, not to GET...
Thank you very much...Again!!!

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