How to have text which overflows textbox to another textbox | Community
Skip to main content
March 18, 2011
Question

How to have text which overflows textbox to another textbox

  • March 18, 2011
  • 12 replies
  • 21394 views

This is something so basic in a word processor...but I cannot figure it out for the life of me. I have a "textbox" which in essence needs to flow over 3 pages. I created the three textboxes...set the source to the same name...now how to I get them to link together so the text can flow from one to the other to the other as text overflows the box?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

12 replies

jasotastic81
Level 8
November 15, 2013

I don't know exactly how to tell you to implement this, but you can script the second field to check for a space " " at the beginning. If it's there, delete the space and continue with whatever is supposed to be there to remove the leading white space.

If there isn't a space, then you have a letter or a punctuation mark--both need to be with their previous characters. So, do a search in the first field for the last time you see a " ". tfText1.lastIndexOf(" ") will find the last space. You truncate the first field at that point and concatenate what's left to the beginning of the next field.

Something like:

tfText2.rawValue = tfText1.slice(tfText1.lastIndexOf(" "))+tfText2.rawValue;

tfText1.rawValue = tfText1.slice(0,tfText1.lastIndexOf(" "));

I think that should pretty much do it.

This is not a perfect solution. There are several ways to make it fail to work properly, but this at least gets your full word at the beginning of the second field. The OP would probably find it useful since his fields were being filled out by imported data. Your example seems to be more interactive. You don't want to constantly check for a space at the beginning and then delete that leading space. And you don't want to move words every time someone exits tfText1. So, a global variable that serves as a flag you can use to check against would help. Then there's still the problem of people editing the first text box. If they delete some words, then you need to move the words back up. That's a whole other set of scripting.

As it is, Adobe Reader alerts you when you reach the end of a field. Perhaps it would be best to just let that happen. Your users can figure out to continue typing on the next page. (You could even put a "hint" in the second field that says "Continue typing here." or something.)

Hopefully this at least pushes you in the right direction.

Jono_Moore
Level 10
November 15, 2013