Expand my Community achievements bar.

SOLVED

Shrinking Text Field

Avatar

Level 3

Hi all,

I have a problem with my textfields in Livecycle. My goal is to have a text field of a certain size that can grow to accommodate more text or shrink to fit text that does not take up the full space that the text field offers. I set my text field height to Expand to Fit and wrote a javascript statement to minimize the size of the text field to fit any text entered. The code is as follows and is in the exit event event of the field:

if ((this.resolveNode("$").rawValue != null && this.resolveNode("$").rawValue != "") && this.resolveNode("$").rawValue != "Enter text here.") {

  this.resolveNode("$").border.presence = "hidden";

  this.resolveNode("$").h = "";

}

What it is supposed to do is minimize the hieght of the text field when the user exits the field so that the field fits the amount of text entered (there is a default value on the field that is "Enter text here."). Everything works perfectly and the field will grow and shrink to fit the text, however when the form is saved and then re-opened, the text field is minimized to an incredibly small size so that only the first line of text is visible and it is cut in half.

I suspect that the problem stems from the fact that the script I wrote sets the hieght to an empty value, but it is only in the exit event so the size of the field shouldn't change from when the form is saved to when it is opened. Does anyone have any ideas for how to fix this?

1 Accepted Solution

Avatar

Correct answer by
Level 8

Replace this.resolveNode("$").h = "" with this.minH = ".01in"

Also, this.resolveNode("$") is the same as just 'this' (as far as I know).

Kyle

View solution in original post

2 Replies

Avatar

Correct answer by
Level 8

Replace this.resolveNode("$").h = "" with this.minH = ".01in"

Also, this.resolveNode("$") is the same as just 'this' (as far as I know).

Kyle

Avatar

Level 3

Your suggestion worked. I didn't think that minH would work to shrink the field but it did. Thank you for your help.