Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Expand To Fit

Avatar

Former Community Member
Hi all,

I have two text fields Text1 and Text2 with different sizes.

On Text2 exit event I do Text1.h = Text2.h and it works.

But if I set the "Expand to Fit" flag on Text2, the Text2.h return 0 (zero).



Is it a bug????



S.M.
8 Replies

Avatar

Former Community Member
It does not look like a bug. The 'h' property is the height of text field with fixed height. Once you make a text field to be "expand to fit" in height, the 'h' property is no applicable and be set to 0.

However, there is a new property associate with "expand to fit" field called minH which is the initial height of that field.

Avatar

Former Community Member
I see, but what I need is the size after the field is expanded not the one before !



Any idea to get it??????



SM

Avatar

Former Community Member
You should query the layout to get the actual size of a field that dynamically sizes like that. So something like this:



var fieldHeight = xfa.layout.h(xfa.form.formName.pageName.fieldName, "in");



The first parameter is the field you want, and the second is an optional parameter for the units you want the height in (in this example I use inches, if you leave it blank you get points).



H.

Avatar

Former Community Member
Hello Billomanik,



I am able to get the field height of one text field by querying as above. But after that, I want this value be assigned to the height property of another text field.

How can I do this?

Please Help

Thank you

Shashi

Avatar

Former Community Member
If you query the height of the dynamically sized text field as above you would do:



OtherTextField.h = fieldHeight;



H.

Avatar

Former Community Member
I did this on the form:layout event, but it didnot work.

Is there on any other event that I should use this java script.



Thanks for you reply

Avatar

Former Community Member
how do you get minH when the text field expands over 2 or more pages?