When you are designing a form you'll often need to check the value of one field and use it to change how another field behaves, or display the value somewhere else on your form.
Default Functions and Event Handler Functions can be used in all of the field types to set and update values as a field loads and when field values change. You can use Handlebars templates to generate HTML to display field values.
Many of the form Form Fields also let you reference field values directly using tokens. This article summarises where and how tokens can be used.
Token Format
Field value tokens have the format
For example, if you had a Confirmation Message Action field, you could create a message that said:
Hi #FIRSTNAME# #LASTNAME#, thanks for completing our form
Which, when displayed on your form would get the values entered into the FIRSTNAME and LASTNAME fields and display them in place of the tokens.
Tokens with Repeating Pages
If you set up Repeating Pages and want to get the value from one of the repeats, you need to include the number of the instance in square brackets, like this
So, using the example above, displaying the values from the second instance of a repeating page:
Hi #FIRSTNAME[1]# #LASTNAME[1]#, thanks for completing our form
The following tokens can be used on a repeating page to display information about the current instance:
#PAGEINSTANCE# - The current page instance (zero-based, ie the first instance is 0)#PAGEINSTANCEDISPLAY# - The user friendly current page instance (one-based, ie the first instance is 1)#PAGEINSTANCEMIN# - The minimum number of instances to generate (set in the forms designer)#PAGEINSTANCEMAX# -The maximum number of instances to generate (set in the forms designer)#PAGEINSTANCECOUNT# - The current number of instances (of this page) that have been generated
Summary of Properties
The following fields and properties can use tokens. Sometimes tokens are used to display values to users, sometimes they are used in a field's settings.
Page Titles
Page titles can use field value tokens.
Field Hints
Every field can use field value tokens in the field hint property.
Error Message Functions
Every field that supports Error Message Functions can use tokens in their custom error messages.
Fields
Alert Box
Field value tokens can be used in the alert text.
API Server Ajax
Field value tokens can be used in the request parameters.
Database Save
Field value tokens can be used to set the object label.
Confirmation Message
Field value tokens can be used in the message text.
Email Action
Field value tokens can be used in:
- Subject
- To
- Cc
- Bcc
- Body
- PDF Name
- PDF body
Guidance Text
Field value tokens can be used in the text.
History - Write Event
Field value tokens can be used in:
- The labels. Two special tokens exist - labela can use the token
#FORM_NAME# and labelb#UNIQUE_ID# - Subject description
- Event
- Event description
- Event history description
- Event user role
HTML Ajax Template
Field value tokens can be used in the request parameters.
Save Button
Field value tokens can be used in:
- Save message. Three special tokens exist -
#PAGEURL# ,#PAGESESSIONID# and#CONTINUEFORMLINK# - Email sent message
- To
- From
- Subject
- Body
Validator
Field value tokens can be used in the error message.
Workflow Complete Task
Field value tokens can be used in:
- Success message. The special tokens exist -
#PROCESSID# ,#BUSINESSKEY# and#TASKID# - Event
- Event description. The tokens
#TASKNAME# and#TASKDESCRIPTION# can be used to access the name and description of the workflow user task.#TASKFORMDESCRIPTION# can access the description of the task form itself - Event private
- Event user role
Workflow Message
Field value tokens can be used in:
- Event
- Event description
- Event private
- Event user role
Workflow Start
Field value tokens can be used in
- The success message. Two special tokens exist -
#PROCESSID# and#BUSINESSKEY# - The history subject description. Four special tokens can also be used -
#PROCESSNAME# ,#PROCESSDESCRIPTION# ,#BUSINESSKEY# and#STARTFORMDESCRIPTION#