Position a Subform at Page Bottom

| 2 Comments

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.

2 Comments

Hi John,
Is it possible to add a spacer in print forms to place a subform at end of page? Your logic works fine for buttons those add/remove rows in the form. but I want this behaviour for print form without buttons. Please let me know if you have an idea.
I appreciate your help.

Thanks & Regards,
Ravi

Ravi:

The existing form should work for both interactive and print. The logic to re-size the spacer subform exists in both the button click event as well as in the layout:ready event of the spacer subform. You might notice some weirdness if you preview this as a print form in Designer (a bug has been logged). But when you print from livecycle forms or output it should work fine.

John

Leave a comment

About this Entry

This page contains a single entry by John Brinkman published on January 23, 2009 10:32 AM.

Paragraph Breaks in Plain Text Fields was the previous entry in this blog.

Populating list boxes is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.