Expand my Community achievements bar.

Height of other fields will adjust automatically based on tallest field.

Avatar

Former Community Member
I have 3 text fields that are allowed to have multiple lines: Field1, Field2, Field3.



Here is what I wanted to happen: everytime I enter data in any of the fields, the form should first compare the height of the 3 fields, get the tallest height among the 3, and finally, the height of the other 2 fields should copy the height of the tallest field.



I already have a script for this. I placed it in the exit event of all 3 fields. Here is the code for Field1:



//gets the height of the 3 fields

var myH = xfa.layout.h(Field1);

var myH2 = xfa.layout.h(Field2);

var myH3 = xfa.layout.h(Field3);



if (myH > myH2 && myH > myH3) //checks if Field1 has the tallest height

{

form1.SF2.Field2.h = myH + "pt";

form1.SF2.Field3.h = myH + "pt";

}



The code works fine but the problem is it only works on the field where i first entered data. For example, I entered 2 lines of data in Field1, the heights of Field2 and Field3 will adjust accordingly. But when I enter 3 lines of data in Field2, the height of all 3 fields are not adjusting.



Can you please help me how to resolve this?
3 Replies

Avatar

Former Community Member
if (myH > myH2 && myH > myH3) //checks if Field1 has the tallest height

{

form1.SF2.Field2.h = myH + "pt";

form1.SF2.Field3.h = myH + "pt";

}



The logic of your code only runs if Field1 is the tallest height and then specifically changes the height of Field2 and Field3. You need to change the logic so that it changes the two fields that are not the tallest height to be equal to the one that is.



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
how does this work if the fields are allowed to expand to fit

Avatar

Former Community Member
ok figured it ouut but what about when it has to expand over a page...the text i'm filling goes to the next page but my empty text box won't it just ends at the end of the first page until it's full then goes on...ideas???