Highlighted

Getting text to autofill within the flow of a text field

New Here ,
Jul 27, 2020

Copy link to clipboard

Copied

I have a contract that will go to multiple companies. I'd like to enter the company name in a text field on page 1 and have that company name referenced in multiple locations through the rest of the document. Is it possible to have this happen automatically? I could search and replace every time I enter a new company but I'd prefer an automatic option.

From what I've read, my best bet is to use a multi-line text field, with rich text enabled... but I'm not sure how to reference the "Company Name" text field appropriately. Am I getting into scripting territory, or is there an easier way?

Apologies if this is a 'rookie question'. Thanks for your help!

Example: Want to replace all green text with whatever is entered in the "Company Name" text field.
Screen Shot 2020-07-27 at 9.53.20 AM.png

Topics

Create PDFs, How to, PDF forms

Views

83

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

Getting text to autofill within the flow of a text field

New Here ,
Jul 27, 2020

Copy link to clipboard

Copied

I have a contract that will go to multiple companies. I'd like to enter the company name in a text field on page 1 and have that company name referenced in multiple locations through the rest of the document. Is it possible to have this happen automatically? I could search and replace every time I enter a new company but I'd prefer an automatic option.

From what I've read, my best bet is to use a multi-line text field, with rich text enabled... but I'm not sure how to reference the "Company Name" text field appropriately. Am I getting into scripting territory, or is there an easier way?

Apologies if this is a 'rookie question'. Thanks for your help!

Example: Want to replace all green text with whatever is entered in the "Company Name" text field.
Screen Shot 2020-07-27 at 9.53.20 AM.png

Topics

Create PDFs, How to, PDF forms

Views

84

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
Adobe Community Professional ,
Jul 27, 2020

Copy link to clipboard

Copied

May be better when you use MS Word or Adobe InDesign.

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
Reply
Loading...
New Here ,
Jul 27, 2020

Copy link to clipboard

Copied

Was building in Acrobat because I'm looking for the final document to be a .pdf contract though, with multiple fields for input.
I could use MS Word and then edit the text/Company Name easily with search and replace, but then I'd lose a lot of the other form features I'm looking to use. My other option is something like DocuSign.

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
Reply
Loading...
Adobe Community Professional ,
Jul 28, 2020

Copy link to clipboard

Copied

Bernd just made me aware that this was a duplicate post. I was answering to your inquiry in that duplicated post so here is what I wanted to contribute with:

 

I have a contract that will go to multiple companies. I'd like to enter the company name in a text field on page 1 and have that company name referenced in multiple locations through the rest of the document. Is it possible to have this happen automatically?

 

  • Yes, this is possible and you can easily use "Duplicate Accross Pages" built-in feature to copy the same field in whatever desired pages you want it to appear. Whatever you input in the text field on page 1 is output in real time in the other fields. You can also change the font type and font size of those copied fields without affecting the main field on page 1. 
  • This is the quickest way to have this done automatically if you don't intend to deal with javascripting, but is not the most convenient way, specially if the document is too big and also if you want to make those fields read-only. Because all the text fields will be labeled with  the same fieldname if you change one field to read-only , all of them will become read-only. 

 

I could search and replace every time I enter a new company, or use something like DocuSign, but I'd prefer an option here.

  • Applying a little javascripting is a better approach than the suggestions above. You don't need to search and replace  each time, nor use a third-party software to automate this task. You can output the value of a text field to autopopulate other textfields. 

 

From what I've read, my best bet is to use a multi-line text field, with rich text enabled.. but I'm not sure how to reference the "Company Name" text field appropriately. Am I getting into scripting territory, or is there an easier way?

 

  • Like I said, with a little javascript and a little creativity this is not as hard as you think. It would be hard if what you were asking was related to a script that can count up to a limit of characters in that paragraph, then insert the Company Name taken from the textfield on page 1, and allow the user to continue to type text in the same paragraph.

 

 

What works for me in my PDFs is  aligning my text fields like this:

 

compname2.png

 

And this is how it would look for the user who will be filling in the form fields:

 

compname1.png

 

 

The small JavaScript portions that you would need to  deal with consist of a small custom keystroke script that will switch the focus from one textfield to the next when one is full;  when one textfield is full the  user can continue to type in the next text field almost seemlessly. 

 

Using the fieldnames illustrated in my first slide example (above),  you can use this little script as the custom calculation script of  "PARAGRAPH 1" texfield:

 

 

 

var f=this.getField ("PARAGRAPH 1");

if (event.fieldFull) {
    getField("PARAGRAPH 2").setFocus();
}

 

 

 

Do the same for PARAGRAPH 2 to the next textfield (PARAGRAPH 3) and so forth 

 

You'll also need a small javascript code that you need to place as a custom calculation script of the textfield that will grab the text output from the company field on page one.

 

In my first slide example  I named the main company field on page one : "COMPANY NAME1" (without the quotes).  And I named  "COMPANY NAME2" the textfield where I want the company name on page one to be referenced.

 

Use a custom calculation script on every field that you intend to reference the company name on page one like this:

 

 

 

event.target.value = this.getField("COMPANY NAME1").valueAsString;

 

 

 

I am aware that this is a long excplanation and lacking some  developer's elegance. But at work I don't have the time to play a lot with scripting when  I have to get stuff done for a big boss. 

 

If you you find my guidance more useful than a band-aid remedy   you're more than welcome to use 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
Reply
Loading...
New Here ,
Jul 28, 2020

Copy link to clipboard

Copied

Going to get to work testing this out, but will this work for something like the first paragraph too?

 

Screen Shot 2020-07-27 at 9.53.20 AM.png

 

So if the company name is too long, the flow continues from field 2 to field 3... but will the preset/pre-existing text (in black) push over from field 3 to field 4. And so forth throughout the document?

Thanks for your help, and sorry about the duplicate post. For some reason it was immediately flagged as spam when I made 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
Reply
Loading...
Adobe Community Professional ,
Jul 28, 2020

Copy link to clipboard

Copied

In MS Word and Adobe InDesign you can use place holders.

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
Reply
Loading...
New Here ,
Jul 28, 2020

Copy link to clipboard

Copied

I'm familiar with this when it comes to inserting fields in Word, and using random/Latin placeholder text, but not how to put in a placeholder that refers to a single user-inputted variable. I could have each user input their company name by teaching them how to do this in Word, but I'd like to avoid having to direct users to change a placeholder field within document properties, or send them something highly editable like it would be in InDesign.
That's why I'm looking for a solution in Acrobat, with a single editable text field that sets the variable throughout the document.

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
Reply
Loading...
Adobe Community Professional ,
Jul 28, 2020

Copy link to clipboard

Copied

Yes this would be the same for 3 and 4, plus You can set the font size to Auto  and aldo when you go to the "Options" tab select the text to be centered. 

 

Font size will reduce the text size automatically if the text reaches the space limit of that field.

 

That said you should disable scrolling text.

 

Using this method may not be eye appealing if a very long company name is typed in because  the text will automatically  reduce too small.

 

However, you can use 'Edit PDF" tool and type in a line of underscores "_" underneath the texfields where you want company name to be referenced.

 

This is what I use in my PDF agreements to give an visual appearance that this is a blank. I use it as a visual aid for the users So that they don't get confused.

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
Reply
Loading...
Most Valuable Participant ,
Aug 06, 2020

Copy link to clipboard

Copied

If you want the rest of the text to flow automatically based on the length of the company name, then it all has to be a part of a single field, yes. You don't need Rich Text Formatting (unless you want it to have a different color than the rest of the text, like in your screenshot), but you do need to set the field as Multiline and use a calculation script for its value, and also set it as read-only. You can use something like this:

 

var companyName = this.getField("CompanyName").valueAsString;

event.value = "This is some text.\nThis is a new line of text.\nThe company's name is " + companyName + ".\nLast line of text.";

 

It will look like this:

 

try67_0-1596702711514.png

 

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
Reply
Loading...
Adobe Community Professional ,
Aug 06, 2020

Copy link to clipboard

Copied

I like that!

 

But then you won't be able to keep text uniformity in such agreement. All the body of the content would appear flushed with the left margin only.

 

 

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
Reply
Loading...
Adobe Community Professional ,
Aug 06, 2020

Copy link to clipboard

Copied

I was comparing with your script what are the possibilities if circumventing this barrier if something can be combined with this other script:

 
 

Word Counting, and Word Count Limit. 

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
Reply
Loading...
ls_rbls LATEST
Adobe Community Professional ,
Aug 06, 2020

Copy link to clipboard

Copied

Another cool script here by George Kaiser :https://answers.acrobatusers.com/Count-characters-q113907.aspx

 

And Splitting an Rebuilding Strings turorial, Thom Parker: https://acrobatusers.com/tutorials/print/splitting-and-rebuilding-strings/

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
Reply
Loading...
Resources
One Stop Solution for Acrobat
Edit a PDF