Skip to main content
Known Participant
May 31, 2025
Answered

Populate a text field based on information typed in another text field

  • May 31, 2025
  • 1 reply
  • 2104 views

I have several text fields where names and addresses are typed into  Names are typed into fields named IP1, IP2, IP3, etc.  Addresses are typed into fields named IP1Address1, IP1Address2, IP2Address1, IP2Address2, etc.  For example, the following information is typed into these text fields:

 

Alan Adams                            111 Alto Avenue            Atlanta, GA 11111

Bob Brenson                          222 Bando Blvd           Birminghame, AL  22222

Charlie Chapman                  333 Connie Court         Cleveland, OH  33333

 

On another page of the pdf file, names can be typed into other text fields.  These text fields are named Name1, Name2, Name3, etc.  After these text fields, there are text fields named Name1Address1, Name1Address2, Name2Address1, Name2Address2, etc. for addresses.

 

If the name Alan Adams is typed into Name1, I would like Name1Address1 to populate with Alan's street address and Name1Address2 to populate with Alan's city, state ZIP.  If Bob's name is typed in Name1, I would like  Name1Address1 to populate with Bob's street address and Name1Address2 to populate with Bob's city, state ZIP.  Is this possible?  Thanks.

 

Correct answer try67

My file contains an attachment page for the Affidavit of Service with name and address boxes for 5-25.  I did not include that.  The doc-level script is named Affidavit of Service.


- I made some adjustments to the code and how it is called. It now takes two parameters, one for the row number and one for the address field number. See the first two rows in the attached file.

- There are errors in the calculation code elsewhere in your file that could be interfering with this script. You need to solve them.

1 reply

try67
Community Expert
Community Expert
May 31, 2025

Yes, but you first need to think how it should work, exactly. Let's say the user changes the address entered for "Alan Adams" on the first page. Should that automatically carry over to the other page, if that name is selected there?

And should they be able to overwrite that value and enter a different address, if they wanted to? What if the name they enter on the second page doesn't match any name on the first one? etc.

Known Participant
May 31, 2025

Good points.  If the user changes the address for Allan Adams on the first page, I would like it to automatically carry over to the other page.

I do not need to provide for overwrites to enter a different address.  In my case, the names entered on the second page will only come from the names entered on the first page.

Known Participant
June 2, 2025

Yes, but updating them will be tricky. I would recommend using a button to do it, instead of an automatic calculation.


I have not worked with buttons before.  Do you have an article or snippet of code to set me in the right direction?  Thank you.