Sections that expand and shrink to accommodate the data being merged are added by making subforms and nesting them into a hierarchy similar to the structure of the data. You can nest subforms to any depth. By nesting them, you can make the form design match the XML data file that will be merged with it. For example, if the XML data file includes two levels, you can create the subform hierarchy by matching the subforms names with the tag names in the XML data file so that LiveCycle Designer ES can map the data without transforming the data file.
A form that has a flowable layout, such as the Purchase Order sample, typically includes various subforms nested together, with one or more objects in each subform. For example, you can see how the different objects in the Purchase Order sample are wrapped in the subforms named header, detailHeader, detail, and total. Notice how you can align text and text field objects into rows and columns and wrap them in a subform. Using subforms to wrap groups of objects such as the various text field objects in the detail subform not only lets you maintain the layout of the objects, but also lets you control how often the subform is repeated.
The sample Purchase Order form whose layout adjusts to accommodate data illustrates how you can use subforms to achieve this configuration. Open the form in LiveCycle Designer ES and look at the Hierarchy palette to examine the structure of the subform, and look at the Object palette to see how the subforms are configured. Pay particular attention to the purchaseOrder, detailHeader, and detail subforms and how they are configured. Keep in mind that the parent subform, which is purchaseOrder, controls the flow of content in the form and expands to fit the available data. The detailHeader subform is configured with a minimum count of 1, which means that when the form is rendered, this subform will appear only once. However, the detail subform is configured to repeat with each data item and therefore, when the form is rendered, will appear as many times as there are occurrences of the data.