Expand my Community achievements bar.

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

Obtaining the Field Height for an Expandable Text Field

Avatar

Former Community Member
I'm trying to generate a "row" that has 4 fields which should all be the same height in order to create a "table" look. Trouble is I'm trying to obtain the field height on a field who's height is set to Expand to fit (since the size of the content will vary when data is bound to the form). The field returns 0in. as its height (since it's designed to grow as required).



I'd like to be able to determine my tallest field and then set all 4 fields to that height so that my row looks consistent.



Any ideas?
2 Replies

Avatar

Former Community Member
Ariane,

I had a similar need except that I only had one field in the group that could grow. But you should be able to modify the script below to do a comparison first to find the tallest fields. I use the following javascript in the Exit event of field that can grow:



var ht = xfa.layout.h(this,"mm");

var ht = ht+"mm";

//app.alert(ht);



this.parent.itemNum.h = ht;

this.parent.objClass.h = ht;

this.parent.costCode.h = ht;

this.parent.Qty.h = ht;

this.parent.Unit.h = ht;

this.parent.unitPrice.h = ht;

this.parent.Recd.h = ht;

this.parent.totPrice.h = ht;



I also have a reset button that clears the form. I had to manually reset all the row fields to the correct height in the click event of my reset button. Good luck!

Avatar

Former Community Member
Brilliant! Thank you!!



My mistake was checking this.h instead of xfa.layout.h