Subforms design elements
Table of contents
is a design element that can hold a number of form elements that are stored as a single design element. Subforms can contain the same elements as regular Form design elements
, with some minor exceptions, such as the HTML Head content, the window title and the [WebQueryOpen] and [WebQuerySave] agents. Subforms also works similar to the include() method on some server side scripting languages, where the programmer can add a piece of code to the current page.
Field names used in the subform can not be used elsewhere on their header forms. Changes you make to a subform affect all forms and documents that use the subform.
Subforms have similar properties to forms. You edit them from the Subform Info tab. The following table lists the subform properties and explains when to use them.
Include in Insert Subform dialog
Lets designers see the subform name when inserting a subform. Excluding a subform from the Insert Subform dialog box is not a security measure. Users with Designer access or higher can open any subform in IBM Lotus Domino Designer and copy individual components. Note that this field does not apply to computed subforms.
Include in New Form dialog
Check this if you want the subform to appear immediately when designers choose Create - Design - Form. Note that this field does not apply to computed subforms.
Render pass through HTML in Notes
Lets you paste HTML directly into the subform. For more information on pasting in HTML, see the topic [passthru HTML, html content type]
Do not add field names to field index
Check this setting to prevent new field names on the subform from being saved in the field index. Checking this setting saves memory.
If you do not check this setting, field names are saved to a table and then stored in memory. Storing field names in memory allows field names to appear in places such as the "Add Action" dialog box.
If in a certain application you want to display the NewWebDoc when a document is created and the SavedWebDoc when a saved document is opened. You can define to each subform contains different fields and html code. The following example shows the Insert Subform formula:
@If(@IsNewDoc; "NewWebDoc"; "SavedWebDoc");
Subform formulas cannot be refreshed while the document is open.
It is important to make sure that a subform is not being used by any form before deleting it. When a user opens a document that has a reference to a deleted subform on the Web, the user will never get notified. The document will just open on the Web browser without any information from the deleted subform. When a designer opens a form that has a reference to a deleted subform, the message following message will appear on the status bar: "Subform: not loaded". When a designer clicks the deleted subform area on the form, the message "Invalid or nonexistent document" appears and the designer cannot open the subform.
To avoid these messages, add another subform to the database and give it the same name as the deleted one.
The subform design element is helpful when designing Web applications. We provide the following list of best practices of when and how to use subforms in order to achieve better design performance and reduce application maintenance:
- Use subforms to hold Web page header information using the $$HTMLHead.
- Instead of using computed subforms to display data on forms that are both used on the Web and on Notes clients, use form hide when for the Web or Notes, or use views form formulas, when applicable.
- Use computed subforms for controlling different Web page display formats, like print pages.
- Consider using subforms to help you Developing hybrid rich client and Web client applications.