How to set text field to auto adjust height for multi-line entry?

New user to Acrobat (full product) here. I've created a 13 page Acrobat FORM utilizing all styles of Fields. I would like to set my text field properties to automatically adjust the height of the field to show ALL text as opposed to showing one line and providing up/down arrows at the end of the field. In other words, if I enter an amount of text that causes my text field to display up/down arrows at the right-side of the field and if I click down twice I see the other two lines one at a time, I would like to set the properties so that all 3 lines show and actually automatically adjust to show the number of lines entered.

Any help is appreciated.


Brian Christoff


1 Answer

This information was taken from : Developing Acrobat® Applications Using JavaScript™ Adobe® Acrobat® SDK November 2006 Version 8.0

Try one of this examples or search and download the latest SDK for Acrobat and do a search for text field.

Example 1
Make a text field multiline and triple its height

var f = this.getField("myText");
var aRect = f.rect; // Get bounding rectangle
f.multiline = true; // Make it multiline
var height = aRect[1]-aRect[3]; // Calculate height
aRect[3] -= 2* height; // Triple the height of the text field
f.rect = aRect; // and make it so


Example 2
Test whether the user has overfilled the text field. A custom keystroke script for a text field. Initially, the field is set so that text does not scroll.

if ( event.fieldFull )
{
app.alert("You've filled the given space with text,"
+ " and as a result, you've lost some text. I'll set the field to"
+ " scroll horizontally, and paste in the rest of your"
+ " missing text.");
this.resetForm([event.target.name]); // Reset field to lose focus
event.target.doNotScroll = false; // Make changes
event.change = event.changeEx;
}

Field properties generally cannot be changed during a keystroke event, so it is necessary for the field to lose focus as a way to commit the data. The user then has to reset the focus and continue entering data.


Eugene Williams   


Please specify a reason: