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.