Forms and documents

When a user creates and fills out the information in a form and saves it, the information is saved as a document. When a user opens the document, the document uses the form as a template to provide the structure for displaying the data. When designing forms, you should consider where and how the resulting documents will be displayed.

A form is stored in the database it was created in and used to display all associated documents. However, there may be times when you are mailing a document to a database that does not have the form that was used to create the document. In those cases you can designate the form to be stored with each document created from it. Storing the form with each document does consume more memory.

When a user opens a document, Domino® uses these rules to determine which form to use to display it:

Condition

Form used to display document

If the form used to create the document is available and there is no form stored in the document and no form formula

The form that was used to create the document. The original form name is stored in a hidden field called "Form" in the document. To find the value of the field you can check the Document Properties box under the Fields tab.

If a form is stored with the document

The form stored with the document. (When a form is stored in a document, the form name is stored in an internal field called $Title.)

If the view has a form formula

The form is determined by the view's form formula.

If the form used to create the document is not available in the database

The default form for the database. Each database can have only one default form, which is marked with an arrow in the Forms list.

Storing a form with each document

Storing the form with each document allows the document to display correctly even in a database where the form is missing, renamed, or deleted. This feature uses more system memory and may require as much as 20 times more disk space. Note that if you change the form design, there is no easy way to update all of the stored copies of the form. In general, store a form in a document only under these conditions:

  • The database to which documents are mailed or pasted does not contain a copy of the original form.
  • The database to which documents are mailed or pasted doesn't share an alias with the original form.
  • The form contains an embedded OLE object or a subscription, and you want documents to reflect any changes to the object.
  • You selected "Include in Search Builder" in the Form Properties box and want the form's static text to be searchable.
Note: Be aware that forwarding a document does not forward a form or its field definitions. If there are instances where you need to forward the form and its definitions, you can check "Store form in document" on the Form Info tab of the Form Properties box.

To store a form with each document

  • Open the form.
  • Choose Design - Form Properties.
  • Click the Form Info tab.
  • Select "Store form in document" and close the Form Properties box.
  • Open Application Properties. At the Basics tab, check "Allow use of stored forms in this database."

Overriding the stored form

When a form is stored in a document, the form name is stored in a hidden field called $Title. Additional information is stored in the $Info, $WindowTitle, and $Body fields. To use a different form to display the document, create an agent that deletes this stored form information and designates another form to display the document.

Shared fields and documents with stored forms

If the form contains a shared field, that field is converted to a single-use field in the copy of the form that is stored in the document. This ensures that if a copy of the document is stored in a database that does not contain the shared field definition, the field can still be used. In the original form, the field is still defined as shared.

Form formulas

To override the default form selection, write a form formula for a particular view. For example, you can write a form formula that uses one form to display all fields when a user edits a document and a different form that re-sequences or omits fields when a user reads a document. Since form formulas apply only to a specific view, documents created in other views do not use the form formula.

Designating a default form for a database

  1. Open the Form Properties box.
  2. Click the Form Info tab.
  3. Select "Default database form."

Alternatives to storing forms

As an alternative to storing the form in a document, you can use the LotusScript® Send method to design a form you can mail along with a document. This ensures that the database will have the correct form to display the document but won't need to store the form with each document.