Skip to main content
Skip table of contents

.Simple Data Binding viText_DITO_1.3

Data binding is the process in which you connect an element or a placeholder within a rich text element with a field from the data collection.

Inserting Data Bindings in Rich Text Elements

The most common use case for data binding is insertion of a data placeholder inside a rich text element. Adding such a placeholder is a three-step process.

Position the Cursor

Position the cursor inside a rich text element, where you want to insert the data binding.

Click the Data Binding Icon

Click the double curly braces icon in the command bar above the editing canvas. Note that this may be located Ășnder the elipsis,

Select the Field to Bind

The data bind property in the properties panel to the right of the editing canvas will be highlighted. Click the three dots to open the data collection.

Select the field that you want to bind and click OK.

As a result, you will see the placeholder in cursor position in the editing canvas.

Note that you can also manually type the name of the field you want to bind in the data bind property. The binding will be resolved relatively to the root of any other binding in which this binding is embedded. For instance if your binding is included in a table row or subform that is bound to a field (e.g. customer), then the binding should be name instead of customer.name. If you want to refer to a field relative to a parent item, you can use $parent. (relative to a parent item) or $. (relative to the root). 

Example

If the data looks like this:

{
"name": "Lucius Malfoy",
"first_name": "Lucius",
"last_name": "Malfoy",
"email": "malfoy@hogwarts.com",
"customer" :
{
"name": "Malfoy, Inc.",
"address_street": "421, Castle Road",
"postal_code" : "84751",
"city" : "East Bedfordshire",
"country" : "United Kingdom"
}

}

You can for instance insert a subform element in your template and bind that to customer. In that case you can bind fields as address.streetpostal_code etc. instead of customer.address_street and customer.postal_code. if you would bind the name field, it would resolve to 'Malfoy.inc'. Should you want to insert 'Lucius Malfoy' instead, the data bind you need is either  $parent.name or $.name.

If the subform is not bound to an element, than the bindings should all be defined as the full path from the root, e.g. customer.address_streetcustomer.postal_code and customer.name for 'Malfoy, inc.' and name for 'Lucius Malfoy'.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.