Using Sample Form Snippets
You can use sample form snippets to easily add commonly used form fields.
- Log into your Spoke Phone account portal online.
- Go to Other > Developers > Form Definitions.
- Click +Add custom form.
- Add a form name, description and form reference.
- Scroll down the page and Select Insert form template or snippet.
- Scroll to or search for the snippet named Option List.
- Click anywhere within the row of Option List to load the form preview on the right.
- Select the icon to the right of the snippet description to add to your form.
- The snippet is added into your form.
HINT: Form snippets are stacked onto the bottom of your existing form.
- Click save.
Once you have a snippet in place, you will want to edit the form fields to suit your needs.
- In the Form Data Definition, after adding the snippet, you can see the line properties:
This is the root that must exist in all forms.
- Following that, you should now see the line string-enum:
This is the 'field' name definition. This defines the data object name that will be used for this field.
- Edit the option values after enum: . Each option must have '- ' (hyphen and space) leading it.
These lines declare the text string option values presented to the user. The selected option will be submitted with the form as the data object value.
- Add a fourth option by following the same pattern.
Note: Spacing and format is important, follow the same pattern carefully.
- In the Form Display Definition you can add a title, help message and description to the field.
- Edit the text following 'ui:title': to change the field title.
- Add a new line with 'ui:help': Help me to add help text for the field.
- Add a new line with 'ui:description': An introductory description of the field.
Note: indentation is important. The title, help and description declarations need to be indented 2 spaces from the field name.
- Click save.
- Test the form using test draft forms in the Spoke Phone App.