Key values are used throughout Verne to store arbitrary data and provide configuration hints. Most key values are not related to UI display and are not sent to the browser in the Render State. Only key values on a white list or those prefixed with "ui-" are sent to the front end.

Whitelisted Key Values

Whitelisted values are key values used by both the UI and the server. To prevent duplication they are allowed to be added to the Render State.

KeyTypeDefaultUsage
repeaterNoAddbooleanfalseUsed on a repeater node will prevent the add function being available.
repeaterNoEditbooleanfalseUsed on a repeater or a repeater’s child record to prevent editing of either all or particular records.
repeaterNoDeletebooleanfalseUsed on a repeater or children record to prevent deletion of the child.
selectedIndexNumberUsed in tab style components to identify the active tab by index.
selectedTabStringUsed in tab style components to identify the active tab by ID.
submitNodeIdStringUsed on the root View Node of the form to identify a button to treat as a submit button.
allowedDocumentTypesCSVUsed on Document repeater nodes to specify allowed mime types for upload.
allowedFileTypesCSV
allowedFileExtensionsCSVUsed on Document repeater nodes to specify allowed extensions for upload.
maxSizeNumberMaximum document upload size.
summaryStringSee documentation for repeater.
detailStringSee documentation for repeater.
tab-visitedbooleanfalseStored against tabs to indicate that the tab has been visited.
validate_successbooleanfalseStored against a tab to indicate it has been successfully validated.
valueNodeStringUsed in lookup component to identify the node in which to store the value (code or id) of the selection from a search.
textNodeStringUsed in lookup component to identify the node in which to store the text of the selection from a search.
min
max
valueAttrStringUsed on a repeater with widget of “pillbox” identifies which attribute of the repeater child to store the value of the lookup against.
textAttrStringUsed on a repeater with widget of “pillbox” identifies which attribute of the repeater child to store the text of the lookup against.
lengthMinNumberMinimum string length for an attribute’s value.
lengthMaxNumberMaximum string length for an attribute’s value.
location-nameStringUsed to identify the CMS location for a piece of content. Update cms component so this doesn’t need to be here.

Common UI Key Values

KeyTypeDefaultUsage
ui-readOnlybooleanfalseSet to make the UI display as read only without changing the readonly attribute of the ViewNode.
ui-ro-widgetStringSet to the name of a widget to have this widget used for display when the View Node is readonly.

Widget Secific Key Values

Glue components can use any key values to help the components maintain their state on the server or to provide configuration for the components behaviour. Key values prefixed with "ui-" are always sent to the browser as part of the render state.

An example of using key values to maintain state on the server is the glue-attribute-date component. As dates are constructed by assembling together key values are used to keep the current state of the day, month and year using key values.

In the RenderState example below the month and day values of the date have been selected but no year has yet been entered.

{
  "root": "ed36020131d573f5",
  "ed36020131d573f5": {
    "id": "ed36020131d573f5",
    "nodetype": "attribute",
    "attribute": "DateOfBirth",
    "text": {
      "label": "Date of Birth"
    },
    "kv": {
      "ui-month": "02",
      "ui-day": "04",
      "ui-year": null
    },
    "dc": "dateOnly",
    "m": true,
    "gs": false,
    "ro": false
  }
}

Setting a Key Value from the Verne API

A key value can be set on a node using the Verne API convenience method setKeyValue.

Catalyst.setKeyValue(nodeid, key, value)

This method returns a promise that will be resovled when the response has returned from the server. Not that while only whitelisted or ui-prefixed key names will be returned to the RenderState any key name can be set on the server.

The convenience method is just a wrapper for the processUpdate method and view-node-set-key-value api command.

The structure of the set key value command is:

{
    "type":"view-node-set-key-value", 
    "id":"nodeId", 
    "key":"key name", 
    "value":"value to set"
}
0
0

Jump to Section