Overview
Variables in NueForm let you create dynamic, personalized form experiences. You can reference respondent answers, URL parameters, and custom form variables anywhere in your question titles, descriptions, welcome screens, and thank-you screens using the {variableName} substitution syntax.
Types of Variables
NueForm supports three types of variables:
1. Answer Variables
Answer variables capture a respondent's answer to a specific question and make it available for use in later questions.
How to set up:
- Select a question in the form builder.
- In the question settings, find the Answer Variable field.
- Enter a variable name (e.g.,
name,company,rating). - The respondent's answer to that question is now stored as
{name},{company}, or{rating}.
Example:
- Question 1: "What is your name?" (Answer Variable:
name) - Question 2 title: "Nice to meet you, {name}! What brings you here today?"
When the respondent types "Sarah" for Question 1, Question 2 will display: "Nice to meet you, Sarah! What brings you here today?"
Value coercion:
| Answer Type | Stored As |
|---|---|
| Text (string) | The text value directly |
| Number | The numeric value as a string |
| Boolean (Yes/No) | "true" or "false" |
| Array (multi-select) | Comma-separated values (e.g., "Option A, Option B") |
| Object (contact info, address) | JSON string |
| Null/undefined | Empty string |
2. URL Variables
URL variables are values passed to the form through URL query parameters. They are available immediately when the form loads, before any questions are answered.
How to use:
Append query parameters to your form URL:
https://nueform.io/f/my-form?firstName=John&company=Acme&source=email
These parameters are automatically available as variables:
{firstName}resolves to "John"{company}resolves to "Acme"{source}resolves to "email"
Use cases:
- Pre-populate form fields with known data.
- Personalize greetings: "Hi {firstName}, we have some questions for you."
- Track referral sources in your response data.
- Route respondents using start logic jumps based on URL parameters.
URL variables can also be used in logic jump conditions. Reference them by prefixing the variable name with url: in the condition field (e.g., url:source). URL variable lookups support case-insensitive fallback, so ?FirstName=John will match a condition on url:firstname.
3. Form Variables
Form variables are predefined variables with a name, type, and default value. They are defined at the form level and can be modified by variable actions in logic jumps.
How to define:
Form variables are defined in the form's variable definitions and have the following properties:
| Property | Description |
|---|---|
| Name | The variable name (e.g., score, category, is_qualified). |
| Type | Either number or string. |
| Default Value | The initial value when the form loads. |
How they are modified:
Form variables are modified through variable actions on logic jumps. When a logic jump's condition matches, its associated variable actions execute:
| Action | Description | Example |
|---|---|---|
set | Replace the variable's value. | Set category to "premium" |
add | Add a number to the variable. | Add 10 to score |
subtract | Subtract a number from the variable. | Subtract 5 from score |
Example: Building a score calculator
- Define a form variable:
score(type: number, default: 0). - On each question, add logic jumps with variable actions:
- If Rating >= 4, add 10 to
score. - If Rating >= 2, add 5 to
score.
- If Rating >= 4, add 10 to
- On the thank-you screen: "Your score is {score} out of 50."
Substitution Syntax
The {variableName} syntax works in the following locations:
| Location | Supported |
|---|---|
| Question titles | Yes |
| Question descriptions | Yes |
| Welcome screen title | Yes |
| Welcome screen description | Yes |
| Thank-you screen title | Yes |
| Thank-you screen description | Yes |
| Form title | Yes |
| Form description | Yes |
| Choice labels | No |
| Button text | No |
| QR Code URL templates | Yes |
How Substitution Works
- The system scans text for
{variableName}patterns (single curly braces with word characters inside). - It looks up the variable name in the current variables map.
- If found, the token is replaced with the variable's value.
- If not found, the token is replaced with an empty string.
Variable names use single curly braces {name}. Do not confuse this with the Markdown inline field syntax, which uses double curly braces {{type:label}}. The two syntaxes are intentionally different and do not conflict.
Variable Detection
NueForm automatically detects all variables referenced across your form by scanning:
{variableName}tokens in all text fields (titles, descriptions, welcome/thank-you screens).url:prefixed fields in logic jump conditions.- Variable names in logic jump actions.
answerVariabledeclarations on questions.- Form-level variable definitions.
This comprehensive scan produces a sorted, deduplicated list of all variable names used in your form.
Variable Resolution Order
When resolving a {variableName} token, NueForm checks variables in this order:
- URL variables -- passed through the form URL.
- Answer variables -- set by the respondent's answers to questions with
answerVariableconfigured. - Form variables -- defined at the form level and modified by logic jump actions.
If the same variable name exists in multiple sources, URL variables take precedence (since they are the source passed to the substitution function along with form/answer variables merged in).
Examples
Personalized Welcome
URL: https://nueform.io/f/feedback?name=Sarah&product=Widget
Welcome Title: "Hi {name}!" Welcome Description: "We'd love to hear your thoughts on {product}."
Result: "Hi Sarah!" / "We'd love to hear your thoughts on Widget."
Dynamic Follow-up Questions
Question 1: "What is your role?" (Answer Variable: role) Question 2: "As a {role}, what is your biggest challenge?"
Calculated Score Display
Form Variable: score (number, default: 0) Logic Jump Actions: Add points based on answers Thank-you Description: "You scored {score} points! Thanks for completing the quiz."
Conditional Routing with URL Variables
URL: https://nueform.io/f/survey?plan=enterprise
Start Logic Jump:
- Condition:
url:planequals"enterprise" - Destination: Jump to enterprise-specific questions
- Action: Set
plan_nameto"Enterprise"
Meilleures pratiques
- Use descriptive names: Choose variable names that clearly indicate what they store (e.g.,
customer_nameinstead ofn). - Set defaults: For form variables, always provide a meaningful default value in case the variable is never modified.
- Test with URL parameters: When using URL variables, test your form with various parameter combinations to ensure all paths work correctly.
- Handle missing variables gracefully: If a URL variable might not be provided, design your text so it reads naturally even when the variable resolves to an empty string.