Welcome to the Alfresco Builder Network

Our technical resource site is still being improved. We'd love to hear your feedback. Tell us what you think

Contains the value and metadata for a field of a Form component.

Properties

NameTypeDefaultDescription
idstringField ID
namestringField name
typestringField type (see Form Rendering service for a list of available type strings)
valueanyField value (implemented by get/set)
readOnlybooleanIs this a read-only field? (Implemented by get/set)
requiredbooleanIs the field required to have a value? (Implemented by get/set)
isValidbooleanDoes the field pass its validation checks? (Implemented by get/set)
overrideIdbooleanShould the auto-generated ID (from name) be overridden to let the user set a custom ID?
tabstringName of the current form tab
rowspannumber1The number of container rows that the field spans
colspannumber1The number of container columns that the field spans
placeholderstringnullPlaceholder text shown before the field is edited
minLengthnumber0Minimum allowed number of characters in input data
maxLengthnumber0Maximum allowed number of characters in input data
minValuestringMinimum allowed value (eg, for number or date)
maxValuestringMinimum allowed value (eg, for number or date)
regexPatternstringRegular expression that text data should match
optionsFormFieldOption[][]Option items for a dropdown menu
restUrlstringURL for a REST call to populate a dropdown menu
restResponsePathstringPath within REST response JSON to the array of dropdown data
restIdPropertystringJSON property name to use for the id property of a dropdown item
restLabelPropertystringJSON property name to use for the label property of a dropdown item
hasEmptyValuebooleanIs the field's value empty? (eg, dropdown with no item selected)
classNamestringCSS class name for the field
optionTypestring
paramsFormFieldMetadata{}
hyperlinkUrlstringURL for Hyperlink widgets
displayTextstringDisplayed text for Hyperlink widgets
isVisiblebooleantrueIs the field shown on the form?
visibilityConditionWidgetVisibilityModelnullDefines a expression that determines whether the field is visible or not, based on its logical relation to values in other fields
enableFractionsbooleanfalseAre numeric values allowed to contain a decimal point?
currencystringnullCurrency symbol for Amount widgets
dateDisplayFormatstringDate/time display format template
numberOfColumnsnumber1Number of columns defined by a container field
fieldsFormFieldModel[][]Fields contained within a container field
columnsContainerColumnModel[][]Column definitions for a container field
emptyOptionFormFieldOptionDropdown menu item to use when no option is chosen
validationSummarystringError/information message added during field validation (see FormFieldValidator interface)

Details

Every field of a form has an associated FormFieldModel instance that contains the field's value and metadata. The standard widgets use this information to render fields and you can also make use of it in your own custom widgets and field validators.

Custom widgets

You will need to use the properties of FormFieldModel if you want to implement your own custom widgets. Aside from the value property (which contains the data value entered into the field), there are also a few other fields that are used for specific types of data. For example, the currency property holds the currency symbol to be displayed next to the value (such as the dollar sign $) and the dateDisplayFormat defines how the elements of a date/time will be arranged. See the Form Extensibility and Customization for more information about creating custom widgets.

Validation

A Form or Task Details component can be supplied with a set of validator objects. Each validator applies a particular kind of check to a field. A number of FormFieldModel properties are used by validators. For example, minValue and maxValue are used to check that a numeric value falls within an allowed range and regexPattern defines a regular expression that a text field should match. Also, the validationSummary is used to send a message back from the validator for the user to read. See the FormFieldValidator page for more information about implementing validators.

REST properties

You can set the items shown on a dropdown menu using data returned by a REST call. The properties used by the call are:

  • restUrl: The URL for the REST service
  • restResponsePath: Optional path to an array within the JSON object returned by the REST call. Each element in the array corresponds to an item on the dropdown.
  • restIdProperty: The name of a JSON property present in each element of the array selected by restResponsePath. Its value will be used for the id property of the dropdown item. restLabelProperty: The name of a JSON property present in each element of the array selected by restResponsePath. Its value will be used for the label property of the dropdown item (ie, the text visible to the user).

The REST Call Task 101 tutorial on the APS community site contains full details about how the REST calls work, along with a worked example.

See also

Interested in trying Alfresco?

Try Now