Skip to main content
Known Participant
September 22, 2017
Answered

populate fields from other fields if checkbox checked.

  • September 22, 2017
  • 1 reply
  • 603 views

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");

This topic has been closed for replies.
Correct answer try67

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;

}

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
September 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;

}

murrjamesAuthor
Known Participant
September 22, 2017

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