Position a Subform at Page Bottom

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.

4 Responses to Position a Subform at Page Bottom

  1. Ravi says:

    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

  2. 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

  3. Tarek Faham says:

    That was really great !

    But, I don’t think this will work for a Form with more complex layout and nested subforms.

    I think a lot of work is needed to do the required calculations to align the footer subform at the bottom.

    Tarek.

    • John Brinkman says:

      Tarek:
      Offhand I can’t think of a condition that would make it fail.
      The size calculations are based on the root subform extent — which will be the same no matter what the complexity.
      If you find a case where it doesn’t work, please let me know.

      John