Form Builder: Fields |
Overview |
|
|
Fields are typically data input fields, but can also be hidden or readonly fields for processing or display purposes. In general:
• | Input fields are based on HTML input tags such as text, password, radiobutton, checkbox, and selection types. |
• | Field Properties determine display,
operation, and processing capabilities of the input (such as HTML input
type, titles, labels, help), as well as declarative and complex validation
for the field value.
As shown in Form Builder Overview, Field Properties are shown in the Properties frame. |
• | Field Object Properties let you
perform operations on the Field (such as add Fields to Groups).
As shown in Form Builder Overview, Field Objects are shown in the Objects frame. |
Adding Fields to Forms |
|
|
Overview |
|
Fields are added to the Form using the Fields toolbar button.
You are first presented with an "Add Field" dialog.
|
When adding a Field, all Fields provide the properties described below. These properties are a subset of the Field Properties available in the Properties frame of the Form Builder.
Field | |
Field Id | Identifier of the Field (see Id). This is a unique reference used in expressions, validation and processing. |
Field Type | Shows the style of editing to use (see Field Type). This is not editable. |
Field title | Alias for the Field Id (see title). |
Fill Container | Makes this Field match the width of the parent object in which it is placed. For example, adding a field in a table cell with "Fill Container" checked sets the width of the field to the width of the table cell. |
Width | Field width in pixels (leave blank for auto). |
Create Label | Adds a Label to the Field. See Using the Add Field Dialogs and About Labels. |
Label Text | Text that can be associated with any Field (see About Labels). |
Properties | |
Mandatory | Specifies entry requirements for the field (see Mandatory). |
Data Type | LabVantage Data Type used for validation and object definition (see Data Type). |
The Properties tab for the Select, Lookup, Checkbox, and Radiobutton Fields contains a few other specialized properties as described below. These properties are a subset of the Field Properties available in the Properties frame of the Form Builder.
Field | Additional Properties | ||||||
Select |
|
||||||
Lookup |
|
||||||
Checkbox |
|
||||||
RadioButton |
|
Using the Add Field Dialogs |
If you do not edit the automatically-assigned Field Id, advancing to the Field title retains the Field Id (below left). You can then enter your own Field title (below right).
![]() |
Checking "Create Label" copies the Field title into the Label Text (below left). You can then change the Label Text if desired (below right).
![]() |
If you edit the automatically-assigned Field Id, advancing to the Field title copies the Field Id into the Field title. You can then enter your own Field title if desired.
![]() |
As in the first scenario, checking "Create Label" copies the Field title into the Label Text and allows you to change the Label Text.
![]() |
After checking Create Label for any Field, the Field dialogs remember that you want to create a Label. Each time you add a Field, Create Label will remain checked until you uncheck it. In this case, the Field title and Label Text remain blank.
When you enter your Field title, advancing to Label Text copies the Field title into Label Text. You can then enter your own and Label Text.
![]() |
About Labels |
Labels are special Fields because they represent text that can be associated with other Fields.
Simply putting text next to a Field does not make it a "Label". When you create a Label, you can associate that text with any Field on the Form. In the example below, a Label that will be rendered as "Control Sample Id" is being associated with Field "textfield1". The "Field" is the title of the Label, which is an alias for the Field Id to provide user-friendly identification. Note that the dropdown lets you select the Field that is associated with the Label.
![]() |
Whether you create a Label when adding a Field (as shown in Using the Add Field Dialogs), or you add a Label as shown above, you will see the Label in the Objects (top left) frame. This text, which can be anywhere on the Form, is associated with the Field you have selected. If this Field is hidden or disabled, the same fate will befall the Label.
You can associate multiple Labels with a Field. They can be anywhere on the Form. The fate of the Labels are linked to their associated Fields. A typical example of this would be...
Volume: | 100 | (ml) |
...where "Volume" and "ml" are Labels associated with the Field for entering the volume.
Below is a more extreme example, where two Labels are in completely different areas of the Form but associated with the same text Field. Note that the Objects Frame shows the association between Fields and Labels.
![]() |
These are the most important distinctions among Field Id, Label, and title:
• | A Field Id is an identifier for the Field's HTML input tag. It is a unique reference used in expressions, validation and processing. |
• | A Label is text that is associated with one or more Fields. |
• | A title an alias for the Field Id to provide user-friendly identification. |
Field Descriptions |
|
|
Here is a summary of the Fields available for use on a Form. Field Properties (the next section) describes configurable properties for all Fields.
Field | Description | |||||||||||
Simple | "Simple" is the only Field that is not based
on a Field Type. Simple Fields are based on LabVantage Editor
styles. When compared to other Fields based on Field Types, using
a Simple Field reduces the number of properties required to define the
Field.
When you choose an Editor style, the Field value selection will be based on that. In the example below, the Field lookup is based on the "Samples" Editor style.
|
|||||||||||
Text | Inserts an HTML <input> tag and sets the Field
Type to "text".
|
|||||||||||
TextArea | Inserts an HTML <input> tag and sets the Field
Type to "textarea".
|
|||||||||||
Formatted Text |
Inserts a text box that accepts HTML input. This allows
a user to enter formatted text into a field. A basic formatting toolbar
is provided by the Formatted Text
Editor. Unlike other fields (which allow a maximum of 4000 characters),
this accepts an unlimited number of characters. Formatted text is saved
in XHTML format.
|
|||||||||||
Password | Inserts an HTML <input> tag and sets the Field
Type to "password".
|
|||||||||||
Select | Inserts an HTML <input> tag and sets the Field
Type to "dropdown".
|
|||||||||||
Date | Inserts a LabVantage date lookup field and sets the Field
Type to "date".
|
|||||||||||
Lookup | Inserts a LabVantage lookup field and sets the Field
Type to "lookup".
|
|||||||||||
File | Allows a file from the local machine be defined as a
field value.
The field is rendered in the eForm Manager as a text box accompanied by a ellipsis button:
|
|||||||||||
Checkbox | Inserts an HTML <input> tag and sets the Field
Type to "checkbox". This Field uses the Data
properties RefTypeId, SQL, or Values.
|
|||||||||||
Radio Button | You need to insert only one radiobutton. It will automatically
render each Reference Value as a separate radiobutton. The Label is linked
to all rendered radiobuttons. The Field Type is set to "radiobutton".
This Field uses the Data properties
RefTypeId, SQL, or Values.
|
|||||||||||
Hidden | Inserts an HTML <input> tag and sets the Field
Type to "hidden".
|
|||||||||||
Display Only | Inserts an HTML <input> tag. The creation mechansim
is the same as text, but the Field Type is set to "readonly".
|
Field Properties |
|
|
The Properties frame for Fields defines properties of the Field selected in the Editing frame or Objects frame.
You can group and sort the display order of Field properties according to your requirements:
![]() |
|
Dragging and dropping fields in the Editing Frame restores Field properties and allows Undo operations, i.e., Field properties are maintained throughout drag and drop operations.
Field properties are categorized below along with their decriptions. In the Properties frame, the Form Builder is designed to show only the properties that can be used with the selected Field.
Behavior |
Property | Description | Enabled with these Fields... | |||||||||||||||||||||||||||||||
Id | Identifier of the Field. This is a unique reference used in expressions, validation and processing. | All. | |||||||||||||||||||||||||||||||
title | Alias for the Field Id.
When you are providing feedback to the user, the Field Id may not be intuitive.
"title" lets you provide something they can understand.
Do not confuse this with a Label. |
All. | |||||||||||||||||||||||||||||||
Field Type | style of editing to use:
|
All. | |||||||||||||||||||||||||||||||
Editor style Id | Editor style used for the Field value selection (see Simple Field for an example). | All. | |||||||||||||||||||||||||||||||
Data Type | LabVantage Data Type (string, number, date, or dateonly)
used to provide the default validation criteria and define object types
in Groovy expressions and processing.
Data Type and Mandatory (below) are automatically checked on save. |
All except "File". | |||||||||||||||||||||||||||||||
Mandatory | Specifies entry requirements for the field:
Mandatory values must exist in order to save data. Validation errors on mandatory fields cannot be overriden. This also accepts Groovy expressions that define "mandatory if . . ." conditions. Examples:
To set the "If Visible" and "If Enabled" options, Groovy expressions should generate"V" to set "If Visible", or "E" to set "If Enabled". |
All. | |||||||||||||||||||||||||||||||
Visible | Can be used to unconditionally configure the Field as
visible (Yes) or invisible (No).
You can also use Groovy to show/hide Fields based on entries made for other Fields, e.g., this Field is visible only if another Field is readonly. |
All. | |||||||||||||||||||||||||||||||
Readonly | Can be used to unconditionally configure the Field as
readonly (Yes) or readwrite (No).
A third option (On Creation) allows a field to be readonly only when the Document is created, i.e., following a "save" event (Create, Draft, or Submit). This is typically used in Worksheet creation, when selection fields must be disabled when the Worksheet is created and fields are bound. You can also use Groovy to enable/disable Fields based on entries made for other Fields, e.g., this Field is readwrite only if another Field is readonly. To set the "On Creation" option, Groovy expressions should generate "C". |
All. |
Property | Description | Enabled with these Fields... | ||||||||||||
Default Value | Value (literal or variable) or Groovy expression to use
as the default value. Default values can be any of the following:
|
All except "File". | ||||||||||||
SDC Id |
|
All except "Formatted Text" and "File". | ||||||||||||
SDC Restrictive From |
These are available after you have selected an SDC Id.
Defines a restrictive "from" clause or restrictive "where"
clause when using the SDC property as the basis for a set of values.
Rather than using a SQL statement, using these properties to qualify
a list of SDC values implements LabVantage security for the set of retrieved
values. |
All except "Formatted Text" and "File". | ||||||||||||
SDC Restrictive Where | ||||||||||||||
RefTypeId | Reference Type that defines values returned for radiobutton
and dropdown Fields. This is the actual value. The refdisplayvalue is
used as the display value if it exists.
This also accepts a Groovy expression to provide dynamic dropdowns (radiobuttons cannot be dynamic). |
"Dropdown" and "Radiobutton" only. | ||||||||||||
SQL | SQL statement that returns values for radiobutton and
dropdown Fields.
The first column is the actual value, the second column is the display value. Other columns are ignored. This also accepts a Groovy expression to provide dynamic dropdowns (radiobuttons cannot be dynamic). This property does not support LabVantage security unless it is built into the query. |
"Dropdown" and "Radiobutton" only. | ||||||||||||
Values | Semicolon-separated literal values to show for radiobutton
and dropdown Fields, e.g., R=Red;G=Green;B=Blue.
This also accepts a Groovy expression to provide dynamic dropdowns (radiobuttons cannot be dynamic). |
"Dropdown", "Radiobutton", and "Checkbox". | ||||||||||||
Value Rule |
Uses a Groovy expression to generate a Field value. Example: database.selectValue( "select projectdesc from s_project where s_projectid = '${fields.project}'" ) The Readonly property for the Field must be set to Yes. Annotations and Followups are supported. |
"Display Only". | ||||||||||||
Reconcile | Defines a Field value that can be reconciled during Double Data Entry (DDE). This is available only if the Form supports DDE. | All except "File" (DDE only). |
NOTE: | If values exist for the SDCId, RefTypeId, SQL, and Values
properties, the precedence is:
|
Lookup |
Validation |
Property | Description | Enabled with these Fields... | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Max Length | Defines a maximum length for data entered in a field
(providing free text entry is permitted). This is a shortcut for the length
validation option, but additionally blocks entry in a field when the maximum
length has been reached.
The value of this property can be bound to a database table column using the expression ddt:tablename.columnname For example, this expression sets Max Length to 80: ddt:s_sample.sampledesc |
"Text", "Textarea", and "Formatted Text" only. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Simple Validation |
Provides an interface to assist in defining rules for validating Field
values (such as "length must be greater than 4 characters and between
1 and 9, otherwise show an error message"). Field validation is
executed "live" during data entry. You can define multiple
validation rules for a Field.
You can validate length against a database column by specifying "Check Length", any Operator except "In" and "Not In", and "Value 1". For example:
You can validate length against a database column by specifying "Check Length", any Operator except "In" and "Not In", and "Value 1". "Value 2" is the column identifier. For example:
|
All. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Script Validation | Alternative to Simple Validation. Provides a facility
to write Groovy script that defines Field validation.
Groovy is not executed "live" during data entry; it is executed only in response to a document operation (such as Check, Draft, Submit). Groovy Script provides access to:
The return value is used as a comparison to the Pass Condition. This example checks if a Project has been entered and, if so, checks to see if it is Active: fields.project.length() > 0 ? database.selectValue ( "select projectstatus from s_project where s_projectid = '${fields.project}'" ) == "Active" : true
|
All. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Pass Condition | Groovy script that defines a "pass" condition. The validation fails and the Message (below) is generated if the return value from the script does not equal the Pass Condition. | All. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Message | Message displayed if validation fails. This can be static
or dynamic.
These tokens are available: fieldid, title, enteredtext. |
All. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Enabled | Specifies conditions under which field validation is
enabled:
This can also be a Groovy expression. |
All. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Autocheck | Makes certain entered text is a valid SDC, Reference
Type, or Value by validating entered text against these:
|
All except "File". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Key Id 1 Field
Key Id 2 Field Key Id 3 Field |
SDI Keys used for mapping Fields to SDC columns.
These properties appear when either the Autocheck or Autolink property is enabled (see Autocheck and Autolink). |
All except "File". Not used with "Formatted Text". |
Datasource Binding |
Property | Description | Used with these Fields... | ||||||
Binding Mode | Used only with Worksheet Forms to bind a Field
to a specific row and column in a Datasource result set. See these topics:
|
All except "File". | ||||||
Bind Error | Used only with Worksheet Forms to define behavior of a Field if it cannot be successfully bound. See Bind Error in eForms Worksheet Principles. | All except "File". |
Layout |
Property | Description | Used with these Fields... |
Help | Help text displayed at the bottom of the form. | All. |
Suppress Repeating | Prevents the field from repeating if its value is the same as the prior field value in the Datasource. | "Text" only. |
View Image File | Allows a file field to be displayed as an image after it
has been uploaded by a Draft or Submit. |
"File" only. |
File Image Width | Allows the width of the image of an uploaded file field to be defined. The View Image File property must be set to Yes. | "File" only. |
File Image Height | Allows the height of the image of an uploaded file field to be defined. The View Image File property must be set to Yes. | "File" only. |
Radio Type | For radiobutton Fields, determines whether to layout the radio buttons in a horizontal or vertical array. | "Radiobutton" only. |
Radio Group | For radiobutton Fields, specifies the Group
of radio buttons to which this radio button belongs.
You assign radio buttons to a Group when you want them to work together. For example, suppose you have 10 radio buttons on the Form. 4 could be in one Group that defines "Color", while 6 could be in another Group that defines "Texture". You would than use this property to assign each radio button to its relevant Group. |
"Radiobutton" only. |
Misc |
Property | Description | Used with these Fields... | ||||||||||
Instrument Type | If the field value will be populated by an Instrument, this is the Instrument Type (see Simple Instruments). | All. | ||||||||||
Instrument Id | If the field value will be populated by an Instrument, this is the identifier if the Instrument (see Simple Instruments). | All. | ||||||||||
Identity Field | An "Identity Field" indicates that the Field
makes this Form unique.
When a Form becomes a Document, it is identified by a unique DocumentId. However, this falls short of identifying a Form under all circumstances. For example, the combination of a Study and a Participant may constitute a unique entity. If you make both Study and Participant Id Fields, you could lookup these Fields using an identifier, or use them to determine if this Form already exists. This is particularly useful when doing Double Data Entry. During data entry, if you enter a value for an Identity Field, then "Draft" or "Submit" the Document... and a Document already exists with this value for this Field... the eForm Manager tells you that you cannot enter the same value. Identity Fields become mandatory Fields during data entry. |
All. | ||||||||||
Autolink | Links Documents based on this Form to other SDIs (through
the SDIDocument table). For example, you could associate Documents based
on this Form to a specific Sample.
By defining an SDC using the SDC Id property, you can setup multiple Fields for autolinking (adding records into the SDIDocument table on save) and autochecking (automatically validating data). The SDI Key Id Fields are automatically populated with the Field Id. Be advised that the "Processing Rules" specified for the Form Definition let you use an Action to make such an association. However, Autolink makes this easier in most situations. Suppose you have a Project on this Form and whenever you enter the ProjectId, you want to automatically associate the current Document with that Project. In this case, Autolink automatically sets up this link through the SDIDocument table. This can be extended to also update a column in the Document table to provide the link. |
All except "File". | ||||||||||
Auto Attach | Adds Field Annotation Attachments to a Field that is linked
to an SDC (see Attachments in
the eForm Manager).
For Fields that are not bound to a Datasource (no Autosave), you must set the SDC Id and the Key Id Fields properties. For example, if the Field defines a Project, all Field Annotation Attachments are automatically associated with the Project as well as the Field. For Fields that are bound to a Datasource (Autosave), the linked SDC is defined by the Datasource result set to which the field is bound. For example, if the Field is bound to a data entry record, the Field Annotation Attachments are associated with the Data Item as well as the Field. |
All. | ||||||||||
Processing Field | Defines a Field that cannot have any validation errors or Followups prior to Form processing. Although processing can proceed if there are outstanding items on the Form, Processing Fields are key to processing. As such, they cannot be missing, invalidated, or pending action during processing. | All. | ||||||||||
Save Field Value | Specifies save behavior for the field:
To set the "If Visible" and "If Enabled" options, Groovy expressions should generate"V" to set "If Visible", or "E" to set "If Enabled". Records will still be generated in the DocumentField table for unsaved field values, but the field value will be blank. |
All. | ||||||||||
Attributes | Opens a dialog where you can specify an identifier and
value to use in Group values,
or any Processing Rules that you define for the Form.
For example, suppose you have a Group of checkboxes. You can specify an identifier and value for each checkbox (such as Id = WorkitemId, Value = Alkali Metals). When processing, you then know the Workitem to create for each box that is checked using: group.attributeList( "workitemid" ) You can create as many attributes for a Field as you like. The key is that you use these attributes when you are processing the form. |
All. | ||||||||||
Show Toolbar | Enables/disables a field popup toolbar. By default, all fields display a popup toolbar when the mouse hovers over the field (except "Hidden" and and "Display Only" field types). | All. |
Variables Exposed in Field Properties |
|
|
Variable Descriptions |
These variables are exposed when evaluating Field properties:
Variable | Description | ||||
fields |
Map containing the Fields of the Form. The value of the Map entry is a Field object that has its own API. However, for most cases, the syntax will be: fields.fielda This is not a String object. It is a shorthand that returns a String object from the Field value. Depending on the data type, the Field value is stored as a String, BigDecimal, or Calendar object. To get the native object, use something like this example: fields.dob.value Whereas fields.dob returns a String representation of the dob (date of birth), fields.dob.value returns a Calendar object. |
||||
fieldinstance | Map containing the Fields of the current sectioninstance. This is used when you have repeating Sections and intra-section expressions. | ||||
user | Map containing string values of the connection details. For example, user.sysuserid is the current user. | ||||
logger | Logger object for logging to sapphire.log. These log entries are also maintained and returned from the script, and ultimately saved in the ProcessingLog column of the SDIDocument table. See Note 1 below. | ||||
database | DBRead object that provides readonly access to the database. See Note 2 below. | ||||
actionProcessor
queryProcessor sdcProcessor |
Standard LabVantage Java Public API Accessors (see Note 3 below). Example: DataSet projects = queryProcessor.getSQLDataSet("select * from s_project " ) Note that there are shorthands for a number of the common methods. Here are some examples:
|
When evaluating Field properties:
1. | The "logger" variable is exposed only when evaluating Complex Validation properties. |
2. | The "database" variable is exposed only when evaluating Complex Validation properties. See About the Database Object below. |
3. | The accessor variables are exposed only when evaluating Complex Validation properties. |
About the Database Object |
The database object is available when evaluating Complex Validation properties for Fields and Complex Validation properties for Groups. The database object has these Groovy-oriented methods, which provide readonly access to the database:
Method | Example |
String getDbms() | if ( database.getDbms().equals( "ORA" ) ) |
boolean isOracle() | if ( database.isOracle() ) |
boolean isSqlServer() | if ( database.isSqlServer() ) |
boolean exists( sql ) | if ( database.exists( "select s_projectid from s_project where s_projectid = '" + fields.project.toString() + "'" ) ) |
int count( sql ) | int projects = database.count( "select count(*) from s_project " ) |
String selectValue( sql ) | This returns a single value... the first column in the
select clause, e.g.,
String desc = database.selectValue( "select projectdesc from s_project where s_projectid = '" + fields.project.toString() + "'" ) |
selectString()
selectDate() selectNumber() |
Returns String, Calendar and BigDecimal types (respectively). |
HashMap selectRow( sql ) | This returns a Map of values selected, e.g.,
HashMap project = database.selectRow( "select * from s_project where s_projectid = '" + fields.project.toString() + "'" ) |
void eachRow( sql, closure ) | This is a very Groovy-centric implementation (the closure
process), but it allows you to iterate over the rows of a select, e.g.,
database.eachRow( "select * from s_project " ) { project -> logger.info( project.s_projectid + ", " + project.projectdesc ) } |
Field Object Properties |
|
|
Objects Frame Context Menus for Fields |
Fields shown in the the Objects Frame have Context Menus that perform operations on the Field.
Right-click "Fields":
Menu Item | Description |
Expand | Expand/collapse (if any Fields exist). |
Collapse |
Right-click a Field:
Objects Frame Context Menu for Fields | |||||||
Menu Item | Description | ||||||
Expand | Expand/collapse (if any items are associated with the Field). | ||||||
Collapse | |||||||
Save As Field | Saves the Field as a Field Definition (see Field and Formlet Definitions). The field in the Form is marked as a "controlled vocabulary" field and honors the new settings for the Field Definition. | ||||||
Add to Group | Opens a dialog that lets you add the selected Fields to
a Group:
Multiple Fields can added to a Group by using Ctrl-Click to select multiple Fields, then right-clicking and selecting Add to Group. |
||||||
Remove from Group | Opens a dialog that lets you remove the Field from a Group:
|
Use the arrows to change the order of Fields in the Object Frame:
Multiple Fields can also be moved. Use Ctrl-Click to select multiple Fields, then use the arrows to change the order.
Shortcut Toolbar for Fields |
Clicking a Field in the Editing Frame opens a shorcut toolbar to provide these functions:
Add To Group |
See Objects Frame Context Menus for Fields above. | |
Insert Label |
See Form Builder Fields → About Labels. | |
Edit Field |
Opens an abbreviated version of the "Add Field" dialog (see Adding Fields to Forms) that lets you change the Field title and select the "Fill Container" option. | |
Save As Field |
See Objects Frame Context Menus for Fields above. | |
Refresh |
Reloads a Controlled Field. |