I would like to auto populate the billing address with the street address when the yes radio button

New Here ,
Aug 09, 2022 Aug 09, 2022

Copy link to clipboard

Copied

Enter this custom calculation script in the BillingAddress field:
I found the following script and it work, except that it will remain blank if the checkbox is not checked off. We need be able to put different info in that field.


if (this.getField("Billing1").value=="Yes")
{
event.value=this.getField("StreetAddress").value;
}
else
{
event.value="";
}

TOPICS
JavaScript , PDF forms

Views

60

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

Community Expert , Aug 09, 2022 Aug 09, 2022

Don't use calculation if you want to be able to enter value manually also.

Use the script I gave you like I explained in post above, just change field names like this:

this.getField("DBA").value = event.target.value == "Off" ? "" : this.getField("Merchant Name").value;

Likes

Translate

Translate
New Here ,
Aug 09, 2022 Aug 09, 2022

Copy link to clipboard

Copied

I am using Foxit PDF Editor, and I'm trying to get a same as above button to work properly. With the above script (I changed it for my needs) it will copy the information if the box is checked, but it will not allow for other information to be entered in that field should the box be unchecked. How can I get it to accept other information?

 

I also found this:

if (this.getField("SameAsAbove").value=="Yes")
getField("DBA").value = getField("Merchant Name").value
else getField("DBA") .value = " ";

I put this in and I get the same results, if the check box is checked it is good, problem is if I don't check the box, I can't put any different info in there.

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
Community Expert ,
Aug 09, 2022 Aug 09, 2022

Copy link to clipboard

Copied

Use this as 'Mouse UP' action of checkbox field:

this.getField("BillingAddress").value = event.target.value == "Off" ? "" : this.getField("StreetAddress").value;

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 ,
Aug 09, 2022 Aug 09, 2022

Copy link to clipboard

Copied

Thank you so much for your response.

The actual fields I am using are as follows.

SameAsAbove = the checkbox

Merchant Name = field one

DBA = field two

if you check the box it should copy from field one to field two, and if not, you should be able to put whatever you want.

 

if (this.getField("SameAsAbove").value=="Yes")
getField("DBA").value = getField("Merchant Name").value
else getField("DBA") .value = " ";

this is from what I have put in under Calulate, Custom calculation script.

how would I write it for this?

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 ,
Aug 09, 2022 Aug 09, 2022

Copy link to clipboard

Copied

I tried that and it did not work.

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
Community Expert ,
Aug 09, 2022 Aug 09, 2022

Copy link to clipboard

Copied

Don't use calculation if you want to be able to enter value manually also.

Use the script I gave you like I explained in post above, just change field names like this:

this.getField("DBA").value = event.target.value == "Off" ? "" : this.getField("Merchant Name").value;

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 ,
Aug 09, 2022 Aug 09, 2022

Copy link to clipboard

Copied

AMAZING!!! THANKS!!!

 

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 ,
Aug 09, 2022 Aug 09, 2022

Copy link to clipboard

Copied

I tried that and then my field one was blank, I tried it out with different fields and could not get it to function the way we want, still have the same problem. How would I add to what I already have that partially works, just saying that if the checkbox is off everything there is irrelavant?

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
Community Expert ,
Aug 09, 2022 Aug 09, 2022

Copy link to clipboard

Copied

Script I gave you does not change your field 'One' only copy value from field 'one' to field 'two' if checkbox is checked and set field 'two' to empty if checkbox is unchecked, and you can enter value manually in field 'two' if necessary.

What exactly you try to achieve?

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 ,
Aug 09, 2022 Aug 09, 2022

Copy link to clipboard

Copied

LATEST

Thanks, I got it!!

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