Live Data Lists
Live Data Lists are perfect if you want to incorporate third-party data with your FormTab form. Simply add a Live Data List field to your form and users will be able to select from a list of values that is loaded dynamically from a cloud server.
Requirements
- A valid, public URL to the data source
- The data returned must be a JSON array (see below for specific format information)
Request Format
A request to a Live Data List URL includes the following POST data:
- username – The user’s FormTab username
- rolling_token – A one-off auth token which can be used to validate an incoming request
- widget_parameters – A JSON encoded array of Key/Values. The contents of this field are defined in the field’s settings and can be used to perform server-side logic before returning the response.
JSON Format
The data returned by your Live Data List URL must be a JSON encoded array of objects. The data returned from the server must be a JSON encoded array of object. Each object must have the following properties:
- status – The server response code (200, 404, 403 etc)
- message – A message field, useful for returning an error response etc
- response – An array of objects conforming to the following format:
- label – This is the value that gets displayed in FormTab if this item is selected
- value – An array of Name/Values. This is the actual value that is saved into the form field. This value is sent through when the Form is submitted. This allows you to provide additional/hidden info which you can use for auto-completing other fields or when processing documents later.
- id – An optional ID for the field
Basic Example
Example JSON Response
{
"status": 200,
"message": "OK",
"response": [
{
"id": "1",
"label": "John Smith",
"value": [
{
"name": "employee_id",
"value": "103150"
}
]
},
{
"id": "2",
"label": "Mary Jane",
"value": [
{
"name": "employee_id",
"value": "102046"
}
]
},
{
"id": "3",
"label": "Kundan Ramisetti",
"value": [
{
"name": "employee_id",
"value": "102891"
}
]
}
]
}
Advanced Example
Optionally each object can contain additional data which is saved to the field when an item is selected from the list. This is useful if you want to include extra information that doesn't need to be visible to the user.
Example JSON Response with Additional Data
{
"status": 200,
"message": "OK",
"response": [
{
"id": "1",
"label": "John Smith",
"value": [
{
"name": "employee_id",
"value": "103150"
},
{
"name": "Phone Number",
"value": "080021492"
}
]
},
{
"id": "2",
"label": "Mary Jane",
"value": [
{
"name": "employee_id",
"value": "102046"
},
{
"name": "Phone Number",
"value": "080022492"
}
]
},
{
"id": "3",
"label": "Virat Solanger",
"value": [
{
"name": "employee_id",
"value": "102891"
},
{
"name": "Phone Number",
"value": "080023492"
}
]
}
]
}
Auto-Completing Form Fields
Live Data Lists can be used to auto-complete other fields in a Form.
- The list must contain additional data (as per the example above)
- If the name of any of these extra values matches the label of another field in the form, the value is applied to that field
Notes
- If more than one field in the Form has the same label, the value is only applied to the first field
- If the Live Data List is in a Table, auto-complete only works on the current row