Document, Repeat Group, and Field definitions
The
Definitions folder contains two folders:
The folders within the
System folder contain all default definition documents that come with Astoria.
Each of these folders contain five subfolders:
- Documents
- Fields
- Folders
- HTML Templates
- Repeat Groups
Important: Do not modify files in the System folder. You may lose your changes during
the next system upgrade. Instead, create documents in the User folder. You
can create new definitions or override existing System definitions by creating
documents in this folder. If you create a definition document with the same name
as the one in the System folder, your definition overrides the Astoria-supplied
definition.
A document definition defines the set of fields
that make up a form of that document type. When a user creates a form of this type,
the system enforces the set of fields that make up the document. Administrators can
define custom document definitions.
A field is a low-level component of a form
document. A field definition is a document that defines the attributes of a field,
one of the most important of which is the type. The type of the field indicates how
it stores its value.
CAUTION:
Do not include a field definition multiple times in a repeat
group or document definition. It results in data loss under some editing
operations.
Examples of field types include:
- Text
- Choice (a list of possible values)
- Check box (on or off)
Other attributes describe how the field is displayed to the user.
A repeat group is a collection of fields that
may occur multiple times in a document. As with document and field definitions, a
repeat group definition is a itself a form document. When you edit a form document
that contains a repeat group, you can specify multiple sets of values for the fields
in the repeat group. For example, you may have a set of fields that specifies an
address (Name, Address, City, State, Zip). By putting these fields into a repeat
group, and putting the repeat group into a document definition, the user is able to
add multiple addresses to instances of that document.
For example, if you want to create a document type that describes the contact information of a person, you can store the following about the person: Name, Job Title, and Phone Numbers.
You need a field to hold the name of the person, so you create a Name field that is of type "small" (which is a one-line text field). Job Title is similar, with another "small" field called JobTitle. For the Phone numbers field, you may want to allow multiple values. So it is considered a repeat group. You may want two pieces of information for each number: the number itself, and what type of device it represents (office phone, mobile, fax, and so on), therefore, the repeat group consists of two fields. The PhoneType field should be of type "choice", and the list of choices could be "office, fax, mobile, home". The Number field is just a "text" field, perhaps with a field validation to verify that it is a well-formed phone number. The PhoneNumber repeat group contains these two fields.
If you want to use a field multiple times, create a similar field definition with a distinct name.
For example, instead of the following:
headerBlock
imageTag
CopyBlock
imageTag
Use fields such as:
headerBlock
imageTag1
CopyBlock
imageTag2
Document definition contains the following:
- Form Type. Type of the form. Form types include:
- Document. Enables users to create, view, and
edit information using forms. The information is stored in a persistent
document in the repository.
- Persistent form. Uses forms to capture input
from users, usually just before processing. A default form can be saved to the repository, users can
modify the defaults when the form is submitted. It also allows the form
designer to disable or hide certain fields from the user.
- Transient form. Similar to persistent form,
but the data is only transient (for example, branch document).
- Fields. A series or Repeat Groups and/or Fields.
- Properties. The properties of this definition. See below for details.
- Property Overrides. Property overrides for specific fields and/or repeat groups. See below for details.
- javaScript. The value is javaScript to be
inserted into the HTML when the document/form is viewed, edited, or
created.
- Repeat Group Definition. Consists of the following:
- Label. Short label that is displayed to the user when editing the repeat group.
- Tip. Hover text.
- Class. The CSS class that governs how this
repeat group is displayed (optional).
- Fields. A list of field definition documents representing the fields that make up this repeat group.
- Properties. The properties of this definition. See below for details.
- Field Definition. Consists of the following:
- Type. Type of the field. Possible types are:
- caption. Unboxed small text that cannot be modified.
- check box. A box that can be selected or not selected.
- choice. One of a list of possible values.
- date. A date and time field.
- dynamic. The actual type is determined at runtime.
- file. A field that allows selection of a repository document object.
- fixed. Small text field that cannot be modified.
- hyperlink. A button that when clicked loads a web page in a browser.
- membership. Zero or more of a list of possible values.
- small. One-line text field.
- large. Multiple-line text field.
- password. Small text field that hides the text that is typed.
- check box. Boolean check box.
- image. Reference to a image file in the repository.
- imagemap. Reference to an imagemap file in the repository.
- imageSimple. A static image rendered as a background.
- textRef. Reference to a structured document in the repository.
- fragRef. Reference to a structured document or element in the repository.
- reference. Reference to any object in the repository.
- Label. Short label that is displayed to the user when editing the field. Specify a message key whose value contains the label text.
- Default. Default value of the field when creating a new document (optional).
- Tip. Hover text. Specify a message key whose value contains the label text.
- Class. CSS class that governs how this field is displayed during editing (optional).
- Properties. The properties of this definition. See below for details.
About Overrides
Overrides consists of triplets of information:
- The name of a field or repeat group
- The name of a property of that field or repeat group
- The value of this property
Specifying an override causes the specified property of the field (or repeat group) to have the specified value. This allows a document definition override field and repeat group properties, and for a repeat group definition to override field properties. For example, the field definition "foo" may have a property name/value, but the document definition "bar", that includes that field definition, may wish to specify a different value for that property. (Without this technique, you have to create a new field definition, identical to the original field definition except for the property of interest, and reference the new field definition in your document definition.)