Content

Overview

Field Definitions

 

Formlet Definitions

Groovy in Field and Formlet Definitions

 

Overview

Top ../images/arwup.gif (846 bytes)

Field Definitions (Lab Admin → eForms → Field Definitions) and Formlet Definitions (Lab Admin → eForms → Formlet Definitions) are SDCs that:

Let you build a library of reusable Fields and Formlets for use in Forms, allowing "common data elements" to be defined among multiple Forms, thus promoting standardization and uniformity of naming and layout.
Are reproductions of Fields and Formlets in the Form Builder. As such, their properties are explained in the Fields section of the Form Bulder documentation. After creating a Field Definition or Formlet Definition, use the Controlled Field and Insert Formlet controls in the Form Builder to insert them into a Form. Additionally, existing Form and Formlet objects on an existing Form can be reverse-engineered to Fields and Formlet Definitions.
Facilitate data mining.

As usual, each of these opens a MaintenanceList page showing existing Form and Formlet Definitions, with the standard "Add" and "Edit" buttons.

 

Field Definitions

Top ../images/arwup.gif (846 bytes)

A Field Definition:

Promotes a "controlled vocabulary" that mandates the use of predefined terms (rather than a "natural language vocabulary" with no restrictions).
Has no layout definition.
Has properties that map directly to those in the Form Builder. All Form Builder properties are available for definition, with the excpetion that only a single Label can be defined in a Field Definition.

Also:

A Field Definition cannot be added to a Form if the Field identifiers clash.
Fields are merged with the existing Form when selected for a new Form.
After the merge, updates to the Field Definition do not update the Form.
Field properties can be locked in the new Form. However, the Field identifier cannot be changed.
An "Add" button on the list page lets you add Fields as you go.
In the Form Builder, you can use the "Save As Field" function in the Objects Frame Context Menus for Fields to save any Field as a Field Definition.
Checking "Editable in Form" allows the Field to be edited in the Form Builder.

After adding a Field Definition, use the "Field Properties" tab to specify properties in the same manner as you would in the Form Builder.


Formlet Definitions

Top ../images/arwup.gif (846 bytes)

A Formlet Definition:

Promotes a standard interface.
Defines a "mini Form", including Field properties and layout.
Is hosted on an HTML div.

Also:

Formlets are merged with the existing Form when selected for a new Form.
Formlets become Sections in the new Form.
You can add a Formlet to a Form "By Reference" to update the Form when the Formlet Definition is updated. See Insert Formlet (in the Form Builder Overview).
Formlet contents and layout can be locked in the new Form.
Formlets can be added to other Formlets.
The width of a Formlet can be dragged to the desired size in the Form Builder. The resulting size is reflected when the Formlet is inserted into a Page.
Formlets are Versioned.
Editable in Form Allows the Formlet to be edited in the Form Builder:
When you "Insert" (not "By Reference"), checking this lets you edit the Formlet directly in the Form. Formlets added to Forms "By Reference" cannot be edited in the Form.
When checked, the value of the "Formlet: Locked" property will be "No". Note that there are two "Locked" properties (seems like one is for the Section (div) and one is for the Formlet).
Whether "Editable in Form" is checked or unchecked, you can use the Context Menu selection (in the Form Builder) "Edit Formlet" to change the Formlet Definition, in which case the Formlet will be updated in the Form (see Insert Formlet in the Form Builder Overview).

Also see Insert Formlet (in the Form Builder Overview) and Formlet (in Form Builder Sections).

Allow AutoSave Binding Adds a Datasource Binding: Binding Mode property for Fields.

After adding a Formlet Definition, use the "Formlet Builder" button or "Formlet Layout" tab to open a version of the Form Builder, where you build a Formlet in the same manner as you would build a Form.

 

Groovy in Field and Formlet Definitions

Top ../images/arwup.gif (846 bytes)

Noteworthy cautions:

Beware of writing Groovy script that refers to other form objects. For example, consider a Field defined by a SQL-based dropdown of Batches that is dependent on a supplier:

"select s_batchid from s_batch where supplier = '${fields.supplier}'"

This dropdown will always be empty if there is no "supplier" Field on the Form.

Certain code references may cause errors (null). For example:

fields.supplier.length() > 0 ? "select s_batchid from s_batch where supplier = '${fields.supplier}'" : "select s_batchid from s_batch"