subform height calculation

utente2

31-07-2020

hi, I'm new to AEM Forms. I would like to ask how to calculate the height of a subform which varies according to the number of data passed. The subform is of the Flowed type, the height varies according to the number of elements contained in it (which depends on the number of data it finds). Is it possible to use javascript to calculate its height before printing, and then, using this value in a if control, to display another subform with a certain height rather than another? Thank you

View Entire Topic

Kosta_Prokopiu1

31-07-2020

Hi,

 

no, that cannot be done. I assume we are talking XFA in Designer.

 

In a dynamic setup as you describe, the final size of the subform, including the necessity to have a page brake (pagination), is determined when the form has been layouted in the renderer. The event layoutReady basically is fired when the form "knows" all the layout elements that are to be placed. At that point in time you cannot re-arrange everything. Print rendering does it once not repeatedly. No script will be able to calculate the size beforehand unless you know the size of each row (constant) and the number of rows in the data.

 

But why would you want to replace the subforms? Do you not want to throw a new page when the data is more than fits?