Skip to main content
Participating Frequently
Sep 29, 2008 9:33 PM UTC
Question

How to LINK two or more Text Field

I have already asked once to get help with creating a link between two text fields (two fields created with a text tool) so that when text reached the end of one text field it will simply go into another. The given explanation was not specific enough. If you know how to do this and are willing to help, would you PLEASE give me SPECIFIC instructions, step-by-step on how this is done. Please do not assume that I have worked with the Adobe Acrobat program all my life. Thanks :)

45 replies

Inspiring
Oct 7, 2008 1:50 PM UTC
George,

Thanks so much for this script. I never would have guessed how to do it without your expert help.
Translate
Inspiring
Oct 7, 2008 1:47 PM UTC
Steven,

I'm not a JavaScripter by any means, but by looking at other scripts I found the missing piece. You must first set the focus on the first field by setting up a variable. I used a "t" for the variable, but it could be any letter. This works for me:

var t=this.getField ("NameOfFirstFieldGoesHere");
if (event.fieldFull) {
getField("NameOfNextFieldGoesHere").setFocus();
}
Translate
Participating Frequently
Oct 6, 2008 8:26 PM UTC
Hi George,

I tried your advice and for some reason the text did not flow into the second field. Here is how the code looked:

if (event.fieldFull)
{
getField("Text2.1").setFocus();
}

I named the second field as it was named "Text2.1" I then tried it and it did not work. Wen the text got to the end of the first field, it just stopped and did not go onto the second field. Any idea why?
I appreciate any troubleshooting suggestion you can offer George... Thanks! Stevan.
Translate
Inspiring
Oct 5, 2008 2:58 AM UTC
George,

This is potentially very helpful script that you provided. However, I followed your instructions precisely and am not able to make the text entered in the first field flow into the second field. I named my first field "firstField" and my second field "secondField" so the JavaScript in the first field looks like this:

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

I'm using Acrobat 8 and 9. Has there been a change to the syntax in the script for Acrobat 8 Pro or 9 Pro?
Translate
Inspiring
Oct 2, 2008 3:05 PM UTC
The first thing you need to do is set up both text fields. Make a note of the name of the second text field.

You then need to add the code above to the Keystroke event of the first text box. To do that, open the field properties dialog, go to the "Format" tab, select "Custom" from the "Select format category" dropdown, click the "Edit" button next to the "Custom Keystroke Script" box, and enter the code given above. Be sure to use the name of your second field in place of the generic field name I used in the code.

Next, go to the "Options" tab and deselect the "Scroll long text" checkbox.

Next, go to the "Appearance" tab and select a font size other than "Auto".

That should do it.

George
Translate
Participant
Feb 17, 2020 4:04 PM UTC

Thanks so much George. This was immensely helpful and solved my problem. Your clear explanation/instructions are much appreciated and were spot on. 

Translate
Participating Frequently
Oct 2, 2008 10:59 AM UTC
Hi George, Can you tell me please how I would go about applying the suggestion into the text field box. Would I go to Properties, Actions, and then what? I am a very average user of the program who just simply wants to make the text flow from one text field unto another, that's it. If you could give me specific instructions on how to do this that woudl be VERY much appreciated. Thanks!
Translate
Inspiring
Oct 2, 2008 2:57 AM UTC
This is possible, but I woudn't say it's a normal thing to do. The Acrobat JavaScript reference does have some sample code for just this situation:

// Move to next field when this one is full
if (event.fieldFull) {
getField("NameOfNextFieldGoesHere").setFocus();
}


This is intended to be placed as the custom Keystroke script for the first field. You'd have to replace "NameOfNextFieldGoesHere" in the code above with the actual name of the second field that you're using. The first field should be set up with a font size other than "Auto" and the "Scroll long text" property should be unchecked. It's also not perfect as is, but should get you started.

George
Translate
Participant
Dec 4, 2019 8:30 PM UTC

This isn't working for me. I copied/pasted the code you have, and still I getting only one line that will not flow into the next text field.

Translate
Thom Parker
Community Expert
Community Expert
Dec 4, 2019 9:02 PM UTC

See this thread:

https://community.adobe.com/t5/acrobat/custom-format-script-go-to-new-line-when-full-utilizing-copy-and-paste-method/m-p/10781199

 

If you still need advice, then please post your question to a new thread. 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participating Frequently
Oct 1, 2008 8:52 PM UTC
Hi George... thanks for your response. This is the information that I can give you. I am using Adobe Acrobat 7 to create my PDF documents. The fields are single line fields (I have several of these under one annother and I want to make sure that the text that comes to an end continues into the other field). If the text comes to an end before it can be completed, I want it to continue into the following line, automatically. The forms thta I have are created in Adobe Acrobt 7 by simply using a text field tool. I have not done any Java programming at all. It was my impression that this is a quite a normal task for which there should be a very simple solution within the tools that are already presnt in the program. Looking forward to your response!
Translate
Inspiring
Sep 30, 2008 4:23 AM UTC
You need to clarify a few things. First, are you talking about text form fields?

If so, are they single line or multiline fields? How, exactly do you want this to behave? For example, what if the end of the field is reached before a word is complete? Are you creating the form in Acrobat of LiveCycle Designer? Have you done any JavaScript programming in Acrobat or Designer? The more details you provide the better.

George
Translate