Forms: Replicator Field
The replicator field allows people to add multiple, structured values to forms.
By default, the field provides for inputs for:
- First Name
- Last Name
- Role
- Company
Adding the " Replicator Field" in the admin section
What the user sees:
Note:
The submitted data is stored as JSON which is a compact, structured format.
For example:
[{"firstName":"Paul","lastName":"Schnell","role":"CTO","company":"Evessio"},{"firstName":"Gary","lastName":"Clement","role":"CEO","company":"Evessio"},{"firstName":"Thomas","lastName":"Howie","role":"COO","company":"Evessio"}]
Customising the fields
it is possible to create customised fields or dropdown lists by adding and modifying the code snippet below to the Description box.
- Copy the whole block starting with <div class="...
- In the form editor click "View HTML" to expose the source view (you might need to expand the box downwards before entering HTML mode)
- Paste the code snippet into the editor and customise the fields as required
<div class="credits-config" style="display: none"> [ { "field": "firstName", "title": "First Name", "required": true }, { "field": "lastName", "title": "Last Name", "required": true }, { "field": "role", "title": "Role", "values": ["CEO", "CTO", "COO", "Director", "Head of Something"], "required": true }, { "field": "company", "title": "Company", "required": true } ] </div>
NOTE
The syntax of quotes and commas is critical! If the format is not followed exactly the fields will be 'broken'.
The customisation structure
"field" - used in the output data structure
"title" - name displayed in the form
"required" - true or false
"values" - [optional] if set, will create a dropdown list
Creating a dropdown list
- By adding a "values" property, a dropdown list of options to select will be created
{ "field": "role", "title": "Role", "values": ["CEO", "CTO", "COO", "Director", "Head of Something"], "required": true }