Example: Including a Form in a Form

In this example, we will replace the General tab of the EAM Person metaclass by a form which includes properties from the person and from the site to which she is assigned by including a form defined on the Site metaclass as a read-only control in a form defined on the Person metaclass.

This example builds on the extension file created in Example: Creating a Property Sheet Tab.
  1. Add the Site metaclass and create a form called Site Address. Select Property Tab from the Type list and unselect the Add to favorite tabs option (as we do not want this form, which duplicates standard site properties displayed in site property sheets).
  2. Populate the form with standard attributes to display the complete address of the site:
    Example - Form in Form 1
  3. Create a form under the Person metaclass, select Replace General tab from the Type list, and change the name to Contact Details.
  4. Delete unwanted attributes from the list, and arrange the remaining attributes you want to display, including the Site attribute (which is of type Object, and which will enable us to pull in the appropriate properties from the associated site form) using horizontal and vertical layouts.
  5. Click the Include Another Form tool, select Site in the Attribute field, and enter Site Address in the Form name field. Select the Read-Only check box to prevent editing of the included form from the person's property sheet:

    Example - Form in Form 2
  6. Click OK to save the extensions, and return to your model. When you next open the property sheet of a person, the General tab is replaced by the custom Contact Details tab, and when the person is assigned to a site, the site's address details are displayed as read-only in the lower part of the form:

    Example - Form in Form 3