Help for fix script to populate ship to fields when I click same as above

New Here ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

Hi, in the attach pdf form. I've 3 fields in customer details section:

1. name

2. address

3. address2

I want to auto populate data from this 3 fields to "Ship to" section (bellow fields) if I click "SameAsAbove" checkbox:

1. Nameofshipping

2. Addressofshipping

2. Address2ofshipping

 

I've added bellow script in the chckbox field<Action<Mouse Up<Ran a Javascript&colon;

 

// check the state of the buttonif(this.getField(event.target.name).value == 'Yes') {// checked// copy address information// get each billing field object's value and set the shipping field's valuethis.getField('name').value = this.getField('nameofshipping').value;this.getField('address').value = this.getField('Addressofshipping').value;this.getField('Address2').value = this.getField('Address2ofshipping').value; // lock fields// set each shipping field's read only property to locked - truethis.getField('name').readonly = true;this.getField('address').readonly = true;this.getField('Address2').readonly = true;} else {// unchecked// unlock fields// set each shipping field's readonly property to unlocked - falsethis.getField('name').readonly = false;this.getField('address').readonly = false;this.getField('Address2').readonly = false;}

 

But the fucntion is not working. anyone could help me in this regard. BTW I've no idea about writing java script. However thanks in advance

 

 

TOPICS
Create PDFs, Edit and convert PDFs, How to, JavaScript, PDF forms

Views

125

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

Adobe Community Professional , Mar 17, 2021 Mar 17, 2021
Change the field calculation order.

Likes

Translate

Translate
Adobe Community Professional ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

Try this code:

if(event.target.value != "Off"){
this.getField("Nameofshipping").value = this.getField("Name").value;
this.getField("Addressofshipping").value = this.getField("Address").value;
this.getField("Address2ofshipping").value = this.getField("Address2").value;
this.getField("Nameofshipping").readonly = true;
this.getField("Addressofshipping").readonly = true;
this.getField("Address2ofshipping").readonly = true;}
else {
this.getField("Nameofshipping").value = "";
this.getField("Addressofshipping").value = "";
this.getField("Address2ofshipping").value = "";
this.getField("Nameofshipping").readonly = false;
this.getField("Addressofshipping").readonly = false;
this.getField("Address2ofshipping").readonly = false;}

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
New Here ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

it worked! Thanks a lot. But having onother problem. Sometimes calculation fields not working properly in this form. I've made a screen record of that problem: https://www.screencast.com/t/l6liUXgvPN

I've attached the form here could you help that will be great. 

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
New Here ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

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
Adobe Community Professional ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

Change the field calculation order.

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
New Here ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

Thanks for your reply Bernd Alheit. I tried to reorder. here is the order of calculation fields: https://www.screencast.com/t/ASj0CFHVuBq

But still "subtotal" field not showing the value of 1st row. when I enter value in 2nd row then it show the result: https://www.screencast.com/t/cXiURSfucY

thanks in advance.

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
Adobe Community Professional ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

The picture shows the tab order, not the field calculation order.

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
New Here ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

Sorry, actually I'm new user of calculation fields. I thought you told me about fields order. Here is the calculation script. It's in order and the fields also: https://www.screencast.com/t/xNmE8qUAooK

Still having the problem.

 

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
New Here ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

LATEST

Not I got it Thanks a lot.

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