Skip to main content

The UI Vocabulary: The Rule-to-UI Contract

An effective dynamic form depends on a clear "contract" between the rules that define the logic and the front-end code that renders the user interface. This document describes that contract.

As a rule author, you must use the entities and attributes defined here to construct the form. The front-end application is built to understand this specific vocabulary and will render the UI accordingly.

The core entity for defining a user interface is UI.


UI

The UI entity is the root element for defining the overall state and flow of the dynamic form.

AttributeData TypeDescription
pathToDataStringDefines the primary data object where user-entered information will be stored. This attribute acts as the bridge between the UI definition and your form data model.
noUiToRenderContinueBooleanSet to true for stages where no UI should be rendered but rules should keep advancing (for routing, enrichment, background calls, etc.).
doneBooleanSet to true to signal the end of the dynamic form flow. The front-end uses this flag to trigger completion behavior.
reportBooleanOptional flag that tells the front-end to render a review/report step before final submission.
nextStageNumberInteger(Action) Set this in rulesheet actions to indicate which stage the form should proceed to next. If this is the final stage, leave this null and set UI.done = true.
currentStageNumberInteger(Precondition/Filter) The front-end sends this value in the request payload. Use it in a rulesheet filter/precondition so rules apply only to the current stage.
labelPositionStringOptional UI default for control label placement (for example 'Above' or 'Side').
languageStringDefines the language context. Rules can set this (for example UI.language = 'italian') to change language dynamically during the form flow.

Container

Represents a logical grouping or panel within a form stage, containing UI controls. A Container is referenced in the rules via the UI.containers collection.

AttributeData TypeDescription
idStringA required, unique identifier for the container within the current stage.
titleStringText rendered as the header (e.g., using an <h3> tag) for the container.
validationMsgStringOptional text displayed as a validation message associated with the entire container.
descriptionStringAn optional descriptive string, not rendered by default but useful for rule troubleshooting or documentation.

UIControl

Represents an individual form element like an input field, text display, or button.

Common UIControl Attributes

AttributeData TypeDescription
typeStringThe specific UI control type to render. This determines which other attributes are required/optional.
fieldNameStringCrucial for data binding. Links the control's value to an attribute within the object targeted by UI.pathToData.
idStringRequired, unique identifier for the control within its container.
labelStringLabel text shown to the user.
valueString, Number, BooleanDefault value for editable controls, or display text for read-only controls.
requiredBooleanIf true, front-end required-field validation is enforced before moving to the next step.
validationErrorMsgStringError text returned by rules and displayed under the control (decision-service validation feedback).
labelPositionStringOptional label placement override (for example 'Above', 'Side').
optionCollection of OptionOption list used by choice controls (MultipleChoices, MultipleChoicesMultiSelect, Radio, MultiExpenses).
multipleBooleanFor supported controls (for example Text, Number, DateTime), enables dynamic multiple entries (array capture).
dataSourceURL (String)REST endpoint used to populate choice-based controls dynamically.
emphasizeBooleanIf true, instructs the renderer to emphasize the control label.
min / maxNumberNumeric min/max for Number; character min/max for Text and TextArea.
minDT / maxDTDate (String)Min/max selectable date for DateTime controls (for example 'YYYY-MM-DD').
sortOptionsStringOptionally instructs the front-end to sort options ('A to Z' or 'Z to A') for choice-based controls.
tooltipStringOptional tooltip/help text for the control label.
triggeredByControlWithIdStringThe id of another control that must be interacted with before this control becomes visible.
triggeredWhenSelectionStringThe value(s) in the triggering control that make this control visible.

UIControl Types

TypeDescriptionKey Attributes & Rule Examples
ReadOnlyTextRenders non-editable text.value: Text to display.
javascript <br/> UIControl.new [type='ReadOnlyText', value='...'] <br/>
TextAreaRenders a multi-line text input field.fieldName, rows, cols, optional min/max (character limits).
javascript <br/> UIControl.new [type='TextArea', fieldName='comments', rows=3, min=10, max=500] <br/>
TextRenders a single-line text input field.fieldName, optional min/max (character limits).
javascript <br/> UIControl.new [type='Text', fieldName='streetAddress', min=5, max=120] <br/>
NumberRenders an input field for numeric entry.fieldName, min, max.
javascript <br/> UIControl.new [type='Number', fieldName='age', min=18] <br/>
DateTimeRenders a date or date-time picker.fieldName, showTime.
javascript <br/> UIControl.new [type='DateTime', fieldName='dob', showTime=false] <br/>
SingleChoiceRenders a single checkbox.fieldName mapped to a Boolean attribute.
javascript <br/> UIControl.new [type='SingleChoice', fieldName='agreedToTerms'] <br/>
RadioRenders a single-select radio button group.fieldName, option list.
javascript <br/> UIControl.new [type='Radio', fieldName='contactMethod'] <br/> myRadio.option += Option.new [value='email', displayName='Email'] <br/>
MultipleChoicesRenders a choice control for single selection (dropdown).fieldName, optional dataSource, options via Option.
javascript <br/> myControl.option += Option.new [value='M', displayName='Male'] <br/>
MultipleChoicesMultiSelectRenders a choice control for multiple selections.fieldName should map to a collection; options via Option.
MultiTextAllows a dynamic number of single-line text inputs.fieldName should map to a collection.
YesNoRenders a binary choice storing 'yes' or 'no'.fieldName mapped to a String attribute.
YesNoBooleanRenders a binary choice storing 'T' or 'F'.fieldName mapped to a String/flag attribute expected by your rules.
FileUploadRenders a file selection button.fieldName.
MultiExpensesComplex control for multiple expense entries.fieldName should map to a collection; Option defines expense types.

DataSourceOptions

Configuration for a UIControl.dataSource if the REST endpoint's JSON structure doesn't match the default.

AttributeData TypeDescription
dataTextFieldStringThe key in the fetched JSON to use for the option's display text.
dataValueFieldStringThe key in the fetched JSON to use for the option's stored value.
pathToOptionsArrayString (JSONPath)The path to the array of options within the JSON response if it's not at the root level (e.g., $.results[*]).
sortBooleanOptional. If true (default), sorts options by display text.
sortDirStringOptional sort direction: 'a' (ascending, default) or 'd' (descending).

Option

Defines a single choice for a MultipleChoices or similar control.

AttributeData TypeDescription
displayNameStringThe text displayed to the user for this option.
valueString, Number, etc.The actual value stored in the data model when this option is selected.

BackgroundData

Retrieves data from a REST endpoint to populate the data model without rendering UI controls.

AttributeData TypeDescription
urlURL (String)The URL of the JSON REST endpoint to fetch data from.
fieldNameNStringThe name of the attribute (e.g., fieldName1) where the fetched data will be stored.
labelNameNStringThe name of the key (e.g., labelName1) in the fetched JSON whose value should be extracted.
pathToValueNString (JSONPath)Optional JSONPath expression used to extract the value from the fetched JSON.
arrayToCollectionBooleanIf true, maps a JSON array to a collection of new entities in the data model. Requires collectionName.
arrayToSetBooleanIf true, extracts values from a fetched array and stores them as a single, comma-separated string.
collectionNameStringRequired when arrayToCollection is true. Specifies the name of the collection attribute in the vocabulary.