A common layout task I’ve heard requested is the ability to place a flowed subform at the bottom of a page. Picture a series of detail subforms followed by a summary. Instead of having the summary positioned immediately below the last detail subform, we want it anchored to the bottom of the page.
There is nothing in the XFA markup that allows this kind of subform placement. However, we can achieve this via script. The solution involves placing a "spacer" subform immediately before the summary subform. Initially the spacer subform has a height of zero. After the initial layout is complete, we calculate how much space is left at the bottom of the page. We then set the height of the spacer subform to the remainder amount and force a re-layout.
With the size taken up by the newly expanded spacer subform, the summary subform will now be positioned at page bottom. To see this work, have a look at the sample form. Notice that as you add/remove detail subforms the summary subform remains at a fixed position. One important detail to make this work is that we added script to the add/remove buttons to clear the current spacer. Before changing the layout we set the height of the spacer subform back to zero and set a form variable to indicate that the spacer needs to be re-evaluated.