Overview
NueForm में variables आपको dynamic, personalized form experiences बनाने देते हैं। आप respondent answers, URL parameters, और custom form variables को {variableName} substitution syntax का उपयोग करके अपने question titles, descriptions, welcome screens, और thank-you screens में कहीं भी reference कर सकते हैं।
Variables के Types
NueForm तीन types के variables support करता है:
1. Answer Variables
Answer variables respondent के किसी specific question के answer को capture करते हैं और बाद के questions में उपयोग के लिए उपलब्ध बनाते हैं।
कैसे set up करें:
- Form builder में एक question select करें।
- Question settings में, Answer Variable field खोजें।
- एक variable name दर्ज करें (जैसे,
name,company,rating)। - उस question पर respondent का answer अब
{name},{company}, या{rating}के रूप में store होता है।
उदाहरण:
- Question 1: "What is your name?" (Answer Variable:
name) - Question 2 title: "Nice to meet you, {name}! What brings you here today?"
जब respondent Question 1 के लिए "Sarah" type करता है, Question 2 display करेगा: "Nice to meet you, Sarah! What brings you here today?"
Value coercion:
| Answer Type | इस रूप में Store होता है |
|---|---|
| Text (string) | Text value सीधे |
| Number | Numeric value string के रूप में |
| Boolean (Yes/No) | "true" या "false" |
| Array (multi-select) | Comma-separated values (जैसे, "Option A, Option B") |
| Object (contact info, address) | JSON string |
| Null/undefined | Empty string |
2. URL Variables
URL variables वे values हैं जो URL query parameters के माध्यम से form में pass की जाती हैं। ये form load होने पर तुरंत उपलब्ध हैं, कोई भी question answer होने से पहले।
कैसे उपयोग करें:
अपने form URL में query parameters append करें:
https://nueform.io/f/my-form?firstName=John&company=Acme&source=email
ये parameters स्वचालित रूप से variables के रूप में उपलब्ध होते हैं:
{firstName}"John" resolve होता है{company}"Acme" resolve होता है{source}"email" resolve होता है
Use cases:
- Known data से form fields pre-populate करें।
- Greetings personalize करें: "Hi {firstName}, we have some questions for you."
- अपने response data में referral sources track करें।
- URL parameters के आधार पर start logic jumps का उपयोग करके respondents को route करें।
URL variables logic jump conditions में भी उपयोग किए जा सकते हैं। Condition field में variable name को url: prefix करके reference करें (जैसे, url:source)। URL variable lookups case-insensitive fallback support करते हैं, इसलिए ?FirstName=John url:firstname पर condition से match होगा।
3. Form Variables
Form variables पूर्वनिर्धारित variables हैं जिनमें name, type, और default value होता है। ये form level पर define होते हैं और logic jumps में variable actions द्वारा modify किए जा सकते हैं।
कैसे define करें:
Form variables form की variable definitions में define होते हैं और इनमें निम्नलिखित properties होती हैं:
| Property | विवरण |
|---|---|
| Name | Variable name (जैसे, score, category, is_qualified)। |
| Type | या तो number या string। |
| Default Value | Form load होने पर initial value। |
कैसे modify होते हैं:
Form variables logic jumps पर variable actions के माध्यम से modify होते हैं। जब logic jump की condition match होती है, तो इसके associated variable actions execute होते हैं:
| Action | विवरण | उदाहरण |
|---|---|---|
set | Variable की value replace करें। | category को "premium" पर set करें |
add | Variable में number add करें। | score में 10 add करें |
subtract | Variable से number subtract करें। | score से 5 subtract करें |
उदाहरण: Score calculator बनाना
- एक form variable define करें:
score(type: number, default: 0)। - प्रत्येक question पर, variable actions के साथ logic jumps जोड़ें:
- यदि Rating >= 4,
scoreमें 10 add करें। - यदि Rating >= 2,
scoreमें 5 add करें।
- यदि Rating >= 4,
- Thank-you screen पर: "Your score is {score} out of 50."
Substitution Syntax
{variableName} syntax निम्नलिखित locations में काम करता है:
| Location | Supported |
|---|---|
| Question titles | हाँ |
| Question descriptions | हाँ |
| Welcome screen title | हाँ |
| Welcome screen description | हाँ |
| Thank-you screen title | हाँ |
| Thank-you screen description | हाँ |
| Form title | हाँ |
| Form description | हाँ |
| Choice labels | नहीं |
| Button text | नहीं |
| QR Code URL templates | हाँ |
Substitution कैसे काम करता है
- System text को
{variableName}patterns (single curly braces के अंदर word characters) के लिए scan करता है। - यह current variables map में variable name look up करता है।
- मिलने पर, token variable की value से replace होता है।
- न मिलने पर, token empty string से replace होता है।
Variable names single curly braces {name} उपयोग करते हैं। इसे Markdown inline field syntax से confuse न करें, जो double curly braces {{type:label}} उपयोग करता है। दोनों syntaxes जानबूझकर अलग हैं और conflict नहीं करते।
Variable Detection
NueForm स्वचालित रूप से आपके form में reference किए गए सभी variables detect करता है, scan करके:
- सभी text fields (titles, descriptions, welcome/thank-you screens) में
{variableName}tokens। - Logic jump conditions में
url:prefixed fields। - Logic jump actions में variable names।
- Questions पर
answerVariabledeclarations। - Form-level variable definitions।
यह comprehensive scan आपके form में उपयोग किए गए सभी variable names की sorted, deduplicated list produce करता है।
Variable Resolution Order
{variableName} token resolve करते समय, NueForm इस क्रम में variables check करता है:
- URL variables -- form URL के माध्यम से pass किए गए।
- Answer variables --
answerVariableconfigured questions पर respondent के answers द्वारा set। - Form variables -- form level पर define और logic jump actions द्वारा modify किए गए।
यदि एक ही variable name multiple sources में exists करता है, तो URL variables प्राथमिकता लेते हैं (क्योंकि ये form/answer variables के साथ merge होकर substitution function में pass किए जाने वाले source हैं)।
उदाहरण
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: Answers के आधार पर points add करें Thank-you Description: "You scored {score} points! Thanks for completing the quiz."
URL Variables के साथ Conditional Routing
URL: https://nueform.io/f/survey?plan=enterprise
Start Logic Jump:
- Condition:
url:planequals"enterprise" - Destination: Enterprise-specific questions पर jump करें
- Action:
plan_nameको"Enterprise"पर set करें
सर्वोत्तम प्रथाएं
- Descriptive names उपयोग करें: Variable names चुनें जो स्पष्ट रूप से indicate करें कि वे क्या store करते हैं (जैसे,
nके बजायcustomer_name)। - Defaults set करें: Form variables के लिए, हमेशा meaningful default value प्रदान करें यदि variable कभी modify न हो।
- URL parameters के साथ test करें: URL variables उपयोग करते समय, सभी paths सही काम करते हैं यह सुनिश्चित करने के लिए विभिन्न parameter combinations के साथ अपने form test करें।
- Missing variables को gracefully handle करें: यदि कोई URL variable provide नहीं किया जा सकता, तो अपना text ऐसे design करें कि variable empty string resolve होने पर भी naturally पढ़ा जाए।