Defining a link dynamically
To dynamically control a link element, the callback handler must respond with an object which defines the link element properties, and this object must be mapped to the link element object.
Note
To map the object in the callback response to the link element object, you must first define the link element ID property.
Otherwise, the link element object will not appear on the Model side of the the mapping tool.
Important
Currently, due to a known bug, mapping individual properties does not currently work for link elements.
You must map the callback response object head to the link element object head.
The callback response object must have the following structure:
{ "type": "object", "properties": { "href": { "type": "string" }, "text": { "type": "string" } } }
where:
href
corresponds to the URL property of the link element.text
corresponds to the Text property of the link element.
Example
Important
This example illustrates mapping individual callback response object properties with individual link element object properties.
Currently, a known bug prevents this technique from working as expected.
You must map the callback response object head to the link element object head.
In this example, the root form contains a table element which displays an array of customer data.
An On row click action is created to trigger a callback called GetWebsite, , which has the request schema mapped to ref field in the user table.
The callback responds with data for the selected customer’s website link, which are mapped to the link element properties.
In this way, each time the user selects a different table row, the link element will be updated.
GetWebsite request schema
{ "type": "object", "$schema": "http://json-schema.org/draft-04/schema", "properties": { "items": { "type": "object", "properties": { "userid": { "type": "string" } } } } }
GetWebsite response schema
{ "type": "object", "$schema": "http://json-schema.org/draft-04/schema", "properties": { "items": { "type": "object", "properties": { "URL": { "type": "string" }, "text": { "type": "string" } } } } }