How to LINK two or more Text Field

Community Beginner ,
Sep 29, 2008 Sep 29, 2008

Copy link to clipboard

Copied

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 :)
TOPICS
PDF forms

Views

55.9K

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 ,
Sep 29, 2008 Sep 29, 2008

Copy link to clipboard

Copied

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

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 Beginner ,
Oct 01, 2008 Oct 01, 2008

Copy link to clipboard

Copied

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!

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 ,
Oct 01, 2008 Oct 01, 2008

Copy link to clipboard

Copied

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

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 ,
Dec 04, 2019 Dec 04, 2019

Copy link to clipboard

Copied

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.

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 ,
Dec 04, 2019 Dec 04, 2019

Copy link to clipboard

Copied

See this thread:

https://community.adobe.com/t5/acrobat/custom-format-script-go-to-new-line-when-full-utilizing-copy-...

 

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

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 ,
Jul 01, 2020 Jul 01, 2020

Copy link to clipboard

Copied

Hi there

I've got FirstName and LastName as two fields due to pre-filling in a form that integrates into my adobe pdf.

 

I want the two fields to look like this:

First Name space Last Name, whereas because they are two fields they currently look more like:

First Name space space space space....... Last Name.

 

I've tried this suggestion and cannot get it to work.  See screenshots attached.  Not sure what i've done wrong, but help1

 

Thanks in advance,

SaScreenshot 2020-07-02 11.16.45.pngScreenshot 2020-07-02 11.16.49.pngScreenshot 2020-07-02 11.17.32.pngScreenshot 2020-07-02 11.17.43.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
community guidelines
New Here ,
Jul 01, 2020 Jul 01, 2020

Copy link to clipboard

Copied

I am not an expert but I don't think that this javascript addresses your question exactly. I used this to have text flow from one text field to another in a multi-line, paragraph area of a form, when the text will go beyond the boundaries of the fields. In your case, you have two text boxes that will most likely never be completely full unless someone has a very long name. Can you use one text box for "name" instead of breaking it up into first and last?

 

Also, to troubleshoot if it's working, I would keep typing in the first box long enough until the text jumps into the second box automatically. If it does, then technically the JS worked, it just doesn't look as clean as you want.

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 ,
Jul 01, 2020 Jul 01, 2020

Copy link to clipboard

Copied

Set the alignment on the first name to right justified. 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 Beginner ,
Oct 02, 2008 Oct 02, 2008

Copy link to clipboard

Copied

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!

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 ,
Oct 02, 2008 Oct 02, 2008

Copy link to clipboard

Copied

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

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 ,
Feb 17, 2020 Feb 17, 2020

Copy link to clipboard

Copied

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

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 ,
Jun 19, 2020 Jun 19, 2020

Copy link to clipboard

Copied

This worked perfectly for me too, thank you so much George!

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 ,
Nov 05, 2020 Nov 05, 2020

Copy link to clipboard

Copied

This was excellent. Thanx a heap!!!

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 ,
Nov 10, 2020 Nov 10, 2020

Copy link to clipboard

Copied

Yay! Thanks, George!!

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 ,
Dec 16, 2020 Dec 16, 2020

Copy link to clipboard

Copied

I am following George's instructions above, however it does not seem to be working for me. I copied and pasted it exactly as posted above, and then replacing 

"NameOfNextFieldGoesHere"

with the name of my field, and making the appropriate changes to the font size and scroll long text.
Do I need to remove any of the spaces from the code as posted above? Or is it intended to have the extra blank lines an spaces? 

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 ,
Jan 05, 2021 Jan 05, 2021

Copy link to clipboard

Copied

When you replace "NameOfNextFieldGoesHere" make sure you keep the quotation marks when you type in your field name.  Also, make sure that you type the field name precisely as it is on the form i.e., upper/lower case or all caps, and include any spaces.

 

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
Enthusiast ,
Oct 04, 2008 Oct 04, 2008

Copy link to clipboard

Copied

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?

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 Beginner ,
Oct 06, 2008 Oct 06, 2008

Copy link to clipboard

Copied

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.

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
Enthusiast ,
Oct 07, 2008 Oct 07, 2008

Copy link to clipboard

Copied

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();
}

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
Enthusiast ,
Oct 07, 2008 Oct 07, 2008

Copy link to clipboard

Copied

George,

Thanks so much for this script. I never would have guessed how to do it without your expert help.

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
Enthusiast ,
Oct 07, 2008 Oct 07, 2008

Copy link to clipboard

Copied

George,

One anomaly I noticed is that if both fields have text and I click in the first field to add text, the new text gets added to the second field -- not where I'm typing. If I select text in the middle of the text in the first field (instead of just clicking an insertion point) and start typing, the selected text is replaced and when I run out of space in the first field the text is added to the second field, but only after skipping over the last part of the text in the first field. In other words, the text is out of order. What is the correct technique to use when adding text?

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 Beginner ,
Oct 08, 2008 Oct 08, 2008

Copy link to clipboard

Copied

Hi Jay..I tried using your code and it did not work for me. When I came to the end of the text box, the text did not go into the second text field. My other question would be, hwo do you make the text flow from one text box into another if you have many text boxes??

I use Adobe Acrobat 7 Thanks for any help you can offer! George's suggestion did not work for me either.

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
Enthusiast ,
Oct 08, 2008 Oct 08, 2008

Copy link to clipboard

Copied

Stevan,

It's almost laughable that I should give instructions since I know very little about JavaScript, but here goes . . .

Be sure to follow George's instruction precisely. Make three text fields, which I'll call Text1, Text2, and Text 3.

1) For the first text field, in the Options tab, remove Multi-line and remove Scroll long text. In the Format tab, in Custom Keystroke Script, click the Edit button, and enter the following:

var t1=this.getField ("Text1");
if (event.fieldFull)
{
getField("Text2").setFocus();
}

2) For the second text field, in the Options tab, remove Multi-line and remove Scroll long text. In the Format tab, in Custom Keystroke Script, click the Edit button, and enter the following:

var t2=this.getField ("Text2");
if (event.fieldFull)
{
getField("Text3").setFocus();
}

Click the Hand tool and start entering text in the first text field. When you run out of space in the first text field it should flow to the second text field and then to the third.

As noted in my previous message of October 7, 8:05, there are some very severe limitations to this technique which I've not been able to overcome. I was hoping that George might have a suggestion to offer about the limitations, but since we haven't heard from him, maybe there are no workarounds for the limitations.

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 Beginner ,
Jul 27, 2009 Jul 27, 2009

Copy link to clipboard

Copied

Jay - You nailed it on Oct 8th '08. I just tried it and it work....but ONLY after I went to the "Appearance" tab and set a font size. I discovered that mine was set to "auto" and that still allowed the text to shrink and not flow. Now it looks to work perfect. Thanks to all for the effort into posting this info! >Robert

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