The SubForm special field lets you link a secondary “child” form to your primary “parent” form so the end user can create a list of similar entries. This function is particularly useful when the number of entries required isn’t known, or when it will vary between users. For example, you might use a SubForm field to create a list of Attendees on an Event Registration form or a list of family members for an insurance form.
Example of a form with a subform open to add additional attendees
Adding a SubForm field is a three-part process. First, the “child” form is created (it needs to be created first before you can link to it). Next a SubForm field is added to the “parent” form. Finally, the SubForm field is linked to the “child” form, and the Linked Form Settings are configured.
Secure Forms & SubFormsIf the parent form is using SSL, the child form must also be configured to use SSL, or it will not load correctly.
Working with SubForm Element DataLearn how to manage the data collected through the parent form and child form in our KB article "Working with SubForm Element Data"
Creating the 'Child' Form
You create the “child” form in the same manner as any form. While there are no set limits on the number of fields a “child” form can contain, it will generally have only a small number of fields. Your child form may be for each attendee at an event, products being ordered or a list of creditors on a financial services form.
Adding the SubForm Field to the 'Parent' Form
To insert the SubForm field below a field already on your form, right-click the field in the Form Outline panel or the Form Workspace, then choose Insert New Form Element > Special Fields > SubForm. The new element appears immediately in the Form Workspace.
Enter a Field Name and configure any other Field Properties as desired.
When you add the SubForm field to your 'parent' form, it includes a default "Example Entry." You'll use the Linked Form Settings property to link the SubForm field to your 'child' form, and to configure the display and functional properties for the SubForm field and the 'child' form.
WarningAfter adding the SubForm element, selecting the child form, and clicking save, the child form will have a special system field added to its outline that will contain a reference to the parent recordID for each child record. This field should not be deleted from the child form or the link between the two forms may no longer function as expected.
Configuring Linked Form Settings
The Linked Form Settings property lets you configure settings for the SubForm field and the associated "child" form. You can configure the following options:
- Linked Form Settings
- Save Changes Made to Child Items Immediately
- Additional Settings
- Optional Validation
- LightBox/Modal Settings
- Content Settings
To configure linked form settings:
- Select the SubForm field in the Form Outline panel, then choose Linked Form Settings from the Field Properties panel to display the Linked Form Settings window.
- Use the Previous and Next buttons to scroll the available options.
- When all desired options have been configured, scroll to the last page and click the Save button.
Use Linked Form Settings to select the 'child' form the SubForm field will link to, select a specific Form View for the 'child' form (if applicable), and select the data sources for columns in the data display area of the SubForm field.
When configuring data sources for the data display area of the SubForm field, you may choose from:
- Any field included in the 'child' form
- The system-supplied RecordID, DataSubmitted or LFUUID (a unique ID assigned to every record)
- The system-supplied ParentRecordID_for_field_(field number), where the field number is the field ID of the SubForm field.
|Linked Form||Specifies the 'child' form that the SubForm field will link to. The menu lists all forms defined for your user account.|
|FormView||Form Views are alternate views of a form created in the Form Designer. If you have created one or more Form Views for your 'child' form, select the view you wish to use. To select the default view, leave this field blank or select the Primary Form Layout.|
|Column 1 Source||Data source for column 1 of the data display area of the SubForm field. This is also the 'default summary field' that is recorded with the 'parent' form. Values from this field are combined into a CSV list within the 'parent' form in the Subform Row Summary field. If desired, you can use Additional Settings to specify an 'alternate summary field' in addition to the 'default summary field.'|
|Column 2 Source||Data source for column 2 of the data display area of the SubForm field.|
|Column 3 Source||Data source for column 3 of the data display area of the SubForm field.|
|Column 4 Source||Data source for column 4 of the data display area of the SubForm field.|
NOTE: While you can define up to four 'Source' columns for display in the data display area of the SubForm field, only one column is required.
Use the Save Changes Made to Child Items Immediately option to specify at what point changes made to 'child' form entries are saved.
|Delayed Commit||Default is selected (enabled). When this option is enabled, changes made to 'child' form entries (including edits and deletions) are only committed when the 'parent' form is submitted.|
Use the Labels settings to define labels and headings for the SubForm field action buttons and data display fields, as shown below.
|Column 1 Heading||Heading for column 1 in the SubForm field; column content is taken from the Column 1 Source specified in Linked Form Settings.|
|Column 2 Heading||Heading for column 2 in the SubForm field; column content is taken from the Column 2 Source specified in Linked Form Settings.|
|Column 3 Heading||Heading for column 3 in the SubForm field; column content is taken from the Column 3 Source specified in Linked Form Settings.|
|Column 4 Heading||Heading for column 4 in the SubForm field; column content is taken from the Column 4 Source specified in Linked Form Settings.|
|Add Button Label||Label for the SubForm field 'Add' button. Default is Add New.|
|Edit Button Label||Label for the SubForm field 'Edit' button. Default is Edit.|
|Allow Delete?||Default is true. When this option is enabled, a 'Delete' button is provided to allow entries to be deleted from the SubForm field.|
|Delete Button Label||Label for the SubForm field 'Delete' button. Default is Delete.|
|Confirm Delete Prompt||Text shown in the confirmation message when the 'Delete' button is selected for a given entry in the SubForm field. Default is "Are you sure you want to delete this entry?"|
Use the Additional Settings to define optional features and functions for the SubForm.
|Alternate Summary Field||The Column 1 Source specified under Linked Form Settings is the 'default summary field' that is recorded with the 'parent' form. Values from this field are combined into a comma seprated list within the 'parent' form in the Subform Row Summary field. Use this parameter to specified a 'secondary summary field.' This function is useful to return and store additional information within the 'parent' record describing data submitted through the 'child' form. When specified, values taken from this field are combined into a CSV list within the 'parent' form in the Additional Child Row Summary field.|
|Child Row Sum
|Specifies a 'numeric' field from the 'child' form used to generate a sum/total of the values from all entries. For example you might return the total cost per registered guest.|
|Child Row Sum
|Specifies an additional 'numeric' field from the 'child' form used to generate a sum/total of the values from all entries. For example, you might return the tax here.|
|URL Params||Lets you display data entered on the 'parent' form in a specified field of the 'child' form. Click the Edit URL Params button to display the URL Parameters window.|
SubForm Element's Meta Fields
When you add a SubForm element to a form, a set of related hidden fields are also added. These fields record the total number of child entries, a summary of entries (based on the first column of data), an alternate summary (optional), total 1 and total 2 (based on the selections described above) and a special field that (once the parent form is submitted) will hold the recordID's of child rows. These fields can be used to display a summary using a free text heading element or in your generated emails and PDFs. The fields are visible in your database and are prefixed with the name you give to the Subform element.
Below is an example of these fields, being used to show a running summary via the Free Text Heading Element, for a Subform element named "attendees":
Use the URL Params option to display data entered on the 'parent' form in a specified field of the 'child' form. For example, if a Registration Form allowed a user to register for a seminar on one of three days, you might wish to display the content from a 'Seminar Date' menu on the 'parent' form in a 'Registering For' field on the 'child' form. Edit URL parameters as follows:
- Click the Edit URL Params button to display the URL Parameters window.
- Click the Add Row button to add a data entry row.
- Select the desired Source Field (the field from the 'parent' form containing the data you want to display on the 'child' form).
- Select the desired Destination field (the field on the 'child' form in which you want to display the value taken from the 'parent' form).
- Repeat steps 2 thru 4 to define additional URL Parameters as needed.
- When all desired URL Parameters have been defined, click the Save button to save your changes.
Use the Optional Validation settings to validate entries made through the 'child' from by a selected field, or by total number of submissions (minimum and/or maximum).
|Validate on Field||The 'child' form field on which validation is performed. If any occurrence of the selected field is blank, the SubForm field on the 'parent' form is considered invalid, and all rows that need correction are highlighted in red. Leave blank if you do not wish to perform validation against a field. Alternately, validation can be used on the 'child' form to ensure each row is validated at the time of creation.|
|Minimum Rows||Indicates the minimum number of entries ('child' form submissions) required. If fewer than the specified number of entries are made, the SubForm field on the 'parent' form is considered invalid, and the field name is highlighted in red. Enter 0 if you do not want to validate against a minimum number of entries. Default is 0.|
|Maximum Rows||Indicates the maximum number of entries ('child' form submissions) allowed. If more than the specified number of entries are made, the SubForm field on the 'parent' form is considered invalid, and the field name is highlighted in red. Enter 0 if you do not want to validate against a maximum number of entries. Default is 0.|
When the 'Add' button in the SubForm field is selected, the SubForm opens in an overlay window. Use the Light Box/Modal Settings to specify display parameters for the SubForm overlay window.
|Window Title||Title shown in the banner of the overlay window.|
|Width||Specifies the width of the overlay window in pixels, from '150' to '1100,' in 50-pixel increments. Default is 600.|
|Height||Specifies the height of the overlay window in pixels, from '150' to '1100,' in 50-pixel increments. Default is 500.|
|Close Button Label||Label for the 'Close' button on the overlay window. Default is Close. To exclude the 'Close' button from the overlay window, leave this value 'blank.'|
|Scrolling||Determines the scrolling mode for the overlay window; select Yes, No, or auto.|
|Modal Window Style||Specifies the window style (banner color) for the overlay window; select default, primary, success, info, warning, danger or link. Default is default.|
|Window Class||If desired, enter a CSS class name and use the workflow custom CSS option to apply custom CSS styles to the overlay window content area.|
|Padding||Determines the padding applied to the content area of the overlay window in pixels. Default is 0.|
|Closable||Default is True. Set to False to suppress the standard 'Close Window' (X) button in the upper right corner of the overlay window.|
Use the Content Settings to optimize the display area of the overlay window.
|Auto Optimize Content||Select this option to suppress display of the form header in the overlay window.|
|Auto Optimize Form Buttons||Suppresses display of the 'Submit' button and 'Reset' link from the 'child' form and the 'Close' button defined under Light Box/Modal Settings, and uses the 'Submit' button and 'Reset' link (or 'Next' and 'Back' buttons for multipage forms) prom the 'parent' form as buttons for the overylay form.|