Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

subform height calculation

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Employee

If you don't know the concept of data binding, repeated subforms, pagination etc it will be difficult to explain that here.

kprokopi_0-1596201625708.png

Here is a table with a repeating row but you need a data set with repeating sections to be bound to your row and fields in the row.

When the page boundaries are hit pagination kicks in and you can define header and footer subforms.

When you use the table object then you can define your header and footer to show on following pages quite easily:

kprokopi_1-1596201821496.pngkprokopi_2-1596201852974.png

 

kprokopi_3-1596201911674.png

 

View solution in original post

7 Replies

Avatar

Employee

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?

 

 

Avatar

Level 2

kprokopi,

I thought I had to calculate the height in advance because I have to insert a series of rows, which can extend over 1 or more pages. Then I have to put a footer in a fixed position at the bottom, and between the last row and the footer another element is required to cover the remaining empty space (in the last page). So I wanted to calculate the height of the subform that contains the rows to set the height of the subform above the footer

 

Avatar

Correct answer by
Employee

If you don't know the concept of data binding, repeated subforms, pagination etc it will be difficult to explain that here.

kprokopi_0-1596201625708.png

Here is a table with a repeating row but you need a data set with repeating sections to be bound to your row and fields in the row.

When the page boundaries are hit pagination kicks in and you can define header and footer subforms.

When you use the table object then you can define your header and footer to show on following pages quite easily:

kprokopi_1-1596201821496.pngkprokopi_2-1596201852974.png

 

kprokopi_3-1596201911674.png

 

Avatar

Level 2

ok thanks, now I only have a doubt. Between the last row and the footer I should insert a graphic element that covers the empty space. To do that the only way I can think of is to delete the empty rows, except one. And let this one have the height of the space left. Is it possible?

Avatar

Employee

Maybe our understanding of what the "footer" is, differs. The footer of a table follows the last element in the table - there is NO GAP between last line and footer.

kprokopi_0-1596440776718.png

A page footer would be completely different - it is placed on the Masterpage and always at the bottom of each page. In that case there would be a gap. But these two "footers" are completely different in concept.

Avatar

Employee Advisor

What kind of form is it? Pdf or adaptive form

@utente2