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

populate fields from other fields if checkbox checked.

Participant ,
Sep 22, 2017 Sep 22, 2017

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
570
Translate
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;

}

Translate
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;

}

Translate
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
LATEST

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

Translate
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