Form variables
Form variables let you define values once and reuse them in different parts of your form.
Updated
For example, you could create a variable called Company Name and use it in several questions or messages. If you need to change the value, you can update the variable instead of editing every place where it appears.
What are form variables?
A form variable is a named value that you can reuse in your form.
OG Forms supports two types:
- Text: Stores a text value, such as a company name or project name.
- Number: Stores a number, such as a score or quantity.
Each variable can also have an optional default value.
You can create up to 50 variables in one form.
How to use a variable
After creating a variable, you can insert it into text using its variable token.
The format is:
{{var:VARIABLE_ID}}Replace VARIABLE_ID with the ID of the variable you want to use.
When the form is shown to a respondent, OG Forms replaces the token with the variable's current value.
Where can you use variables?
Variables use the same system as answer piping. You can use them in text throughout your form, including:
- Question titles and descriptions
- Screen titles
- Button labels
- Welcome page text
- Thank-you page text
- Confirmation email messages
In the builder and exports, variable tokens appear as @Variable Name, making it easier to identify the value being used.
Form variables and answer piping
Both features let you reuse information, but they serve different purposes.
| Feature | What it uses |
|---|---|
| Form variables | Values you define in the Variables panel |
| Answer piping | Answers submitted by the respondent |
For example, use a form variable to display a fixed company name. Use answer piping to display the name entered by the respondent.
Read Answer piping to learn how to reuse answers from earlier questions.
What is not supported yet?
Form variables currently support text and number values with optional defaults.
The following features are not available yet:
- Formula functions such as
SUM(),IF(),AVG()andCONCAT(). - Setting variable values through URL parameters.