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

How to make the bill to address auto populate the ship to address if a checkbox is checked?

New Here ,
Nov 14, 2018 Nov 14, 2018

Copy link to clipboard

Copied

Hello,

I'm creating a form in which if someone fills out the bill to section of the form and checks our "Same As  Bill To" check box, then all the rest of the fields will auto populate. So far I have had no luck executing this.

My check box is named "SameAsBillTo", and if it's checked I want all the following field names to equal each other:

Customer name2 ("CustomerName2") = Customer Name1 ("CustomerName1")

"Street2" = "Street1"

"City2" = "City1"

"State2" = "State1"

"Zip2" = "Zip1"

"Contact2" = "Contact1"

"ContactEmail2" = "ContactEmail1"

"ContactPhone2" = "ContactPhone1"

I have minor experience using javascript editor but, previously I have been successful using it for formulas. I researched this question on a bunch of other forums and have tried coping similar codes and have matched it with mine, but nothing has worked yet.  Below is an example of my current code:

if(SameAsBillTo=="Yes"){

this.getField("CustomerName2").value = this.getField("CustomerName1").valueAsString;

this.getField("Street2").value = this.getField("Street1").valueAsString;

this.getField("City2").value = this.getField("City1").valueAsString;

this.getField("State2").value = this.getField("State1").valueAsString;

this.getField("Zip2").value = this.getField("Zip1").valueAsString;

this.getField("Contact2").value = this.getField("Contact1").valueAsString;

this.getField("ContactEmail2").value = this.getField("ContactEmail1").valueAsString;

this.getField("ContactPhone2").value = this.getField("ContactPhone1").valueAsString;

}

Note - "SameAsBillTo" is my check box

Am I on the right path and just messing up the code? Or is there a total different code I need to use? Any help would be much appreciated!

TOPICS
Acrobat SDK and JavaScript , Windows

Views

588

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 15, 2018 Nov 15, 2018

The field "CustomerName1" doesn't exist in the form.

Votes

Translate

Translate
Community Expert ,
Nov 14, 2018 Nov 14, 2018

Copy link to clipboard

Copied

Change the first line to:

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

And put the code as the Mouse Up event of the check-box field, and it should work (provided you entered the correct field names, of course).

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
New Here ,
Nov 14, 2018 Nov 14, 2018

Copy link to clipboard

Copied

Thank you for the quick response!

I made the change and the code is under the Mouse Up event but I'm still not showing any results. Any other ideas?

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 14, 2018 Nov 14, 2018

Copy link to clipboard

Copied

Check the JS Console (Ctrl+J) for error messages, and/or share the actual

file with us.

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
New Here ,
Nov 15, 2018 Nov 15, 2018

Copy link to clipboard

Copied

Here is a link to the file. Thank you for your help!

Adobe Document Cloud

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 15, 2018 Nov 15, 2018

Copy link to clipboard

Copied

The field "CustomerName1" doesn't exist in the form.

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
New Here ,
Nov 15, 2018 Nov 15, 2018

Copy link to clipboard

Copied

LATEST

Wow! I had a space between customer and name and couldn't tell. Thank you all for your help it's working now!.

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