open
A single free-text input. Use for short answers, names, comments, anything where the respondent types rather than picks. Two styles — single-line text and multi-line textarea.
What open is
open collects one free-text answer. The runtime stores the typed
text as a string. Use it for names, email addresses, comments, “Other
(please specify)” follow-ups — anywhere the respondent should type
rather than pick.
- qid: QFeedback
type: open
text: Anything else you'd like to share?
style: textarea
input.rows: 5
Properties
| Property | Values | Notes |
|---|---|---|
qid | string | Required. Unique within the survey. |
type | open | Required. |
title, text, instruction | renderable | Visible content. Use {{ }} to pipe runtime values. HTML allowed. |
required | True | False | Default True. |
default.errors | True | False | custom string | Default True. |
validation | code block | Python; call fail() to reject invalid input. No default. |
readonly | True | False | Default False. Set True to render the question but disable input — the respondent sees the field but can’t type into it. Common pattern: combine with input.source: js for JS-fed prefilled fields. Pair with visibility: hide to fully hide a helper question. |
visibility | show | hide | Default show. |
style | text | textarea | Default text. |
input.size | integer | Width of the input box in characters. Default sizes itself to the container. |
input.rows | integer | Visible rows for style: textarea. Default 4. Ignored for style: text. |
input.maxChar | integer | Maximum allowed text length. No default — unlimited unless set. |
input.minChar | integer | Minimum required length. No default. |
input.source | default | js | Default default (respondent-entered). Set js for JS / system-fed values. |
options | isolate-only coded list | Opt-out shape. The only valid entries under options: on an open question are isolate: True opt-out toggles (“Prefer not to answer” / “None of these apply”). Non-isolate options are silent — they have nowhere to render on a scalar text input. See Isolate opt-out below. |
custom | code block | Custom runtime block. No default. |
Methods & accessors
open is the simplest type — a single string. The runtime surface
mirrors that.
Accessors
| Expression | Returns | Meaning |
|---|---|---|
Q.value | str | The typed text. Empty string when unanswered. |
Q.answered | bool | True once the respondent has typed at least one character (or set the value via script). |
Q.notAnswered | bool | Inverse of answered. |
Methods
| Expression | Returns | Meaning |
|---|---|---|
Q.set("hello") | None | Set the value to a string. Used in scripts for hidden helpers or JS-fed prefill. |
Q.set("") | None | Set to empty string. Same effect as Q.reset() for most purposes. |
Q.reset() | None | Clear the value. |
open.set() only accepts a string. Numbers will be rejected — for
numeric input use number.
String operations on Q.value
Q.value is a Python string, so the standard string methods are
available:
| Expression | Returns | Meaning |
|---|---|---|
len(Q.value) | int | Length of the typed text. |
Q.value.strip() | str | Whitespace trimmed from both ends. |
Q.value.lower() | str | Lowercased. |
Q.value.upper() | str | Uppercased. |
Q.value == "yes" | bool | Direct string comparison. |
"yes" in Q.value | bool | Substring containment. |
Q.value.startswith("Q") | bool | Prefix check. |
Q.value.endswith(".") | bool | Suffix check. |
re.match(pattern, Q.value) | match | None | Regex check (requires import re in scripts). |
See Builtins & operators for the full string method reference.
Skins
Two visual styles. Pick by expected answer length.
text Text (default) textarea Textarea The exact appearance is driven by theme tokens — colours, radii, fonts. See Customisation.
See it work
A working preview. Type into the field and watch the Live state panel update.
QFeedback.answeredFalseQFeedback.value""len(QFeedback.value)0- qid: QFeedback
type: open
text: What did you think of the experience?
style: textarea
input.rows: 4
Methods & accessors — live
Type into the input and watch each expression’s return value update.
QFeedback.answered → — QFeedback.notAnswered → — QFeedback.value → — len(QFeedback.value) → — len(QFeedback.value.strip()) → — QFeedback.value.lower() → — QFeedback.value.strip() → — QFeedback.value == "yes" → — len(QFeedback.value) > 10 → — len(QFeedback.value) >= 50 → — A few things to notice as you type:
valueis a string, always. Even an empty input returns"", notNone. Compare tosingle, wherevalueis aCode(number) orNone.answeredflips toTrueas soon as there’s at least one character. Uselen(value.strip()) > 0if you want to treat whitespace-only as unanswered.len(value)is the workhorse for validation — most “must type at least N characters” rules are justlen(value) >= N.- String methods chain:
value.strip().lower()is a normalised comparison-ready form.
Isolate opt-out
Attach an isolate: True entry under an options: block to give the respondent a “Prefer not to answer / None of these apply” toggle below the input. Selecting it:
- Clears + disables the text input
- Waives the
requiredgate so the respondent can proceed - Records once in the export as a flag column
<qid>o<code>=1
- qid: QComment
type: open
text: Anything else you'd like to add?
required: True
options:
99:
label: Prefer not to answer
isolate: True
exclusive: True
options: on a scalar open is opt-out only — a non-isolate entry has nowhere to render, so use it strictly for the toggle. Pair isolate: True with exclusive: True for the clear-and-null behaviour the server enforces.
Read the opt-out in scripts:
if QComment.answered and QComment.value is None:
# respondent opted out
hCommentDeclined.set(1)
Examples
Optional comment
- qid: QExtra
type: open
text: Anything else?
required: False
style: textarea
input.rows: 4
required: False lets the respondent skip. Without it, open
defaults to required and an empty submission is rejected.
Email validation
- qid: QEmail
type: open
text: Your email address
input.maxChar: 120
validation: |
import re
if not re.fullmatch(r"[^@\s]+@[^@\s]+\.[^@\s]+", QEmail.value or ""):
fail("Please enter a valid email address.")
input.maxChar enforces a length cap at the input level (the
respondent can’t type past 120 chars). validation: then checks the
shape with a regex. Multiple gates are common — input.* for
limits, validation: for content rules.
Minimum length
- qid: QStory
type: open
text: Tell us a story.
style: textarea
input.rows: 6
input.minChar: 50
validation: |
if len(QStory.value.strip()) < 50:
fail("Please write at least 50 characters.")
input.minChar is enforced by the platform; the explicit
validation: block here gives a custom message and trims whitespace
so a paragraph of spaces doesn’t pass.
Hidden JS-fed value (panel id, source URL)
- qid: hPanelId
type: open
input.source: js
visibility: hide
readonly: True
required: False
input.source: js tells the platform this question’s value is
populated by JavaScript — typically from URL parameters when a
respondent arrives from a panel link. visibility: hide keeps the
respondent from seeing it; readonly: True makes sure it can’t be
edited. The value still exports normally.
Pipe a previous open answer
- qid: QName
type: open
text: What's your first name?
- qid: QGreeting
type: info
text: Welcome, {{ QName.value }}.
Piping Q.value from an open is one of the simplest uses of
{{ }} — the typed string is substituted in directly.
Comparison and routing on open
- qid: QRole
type: open
text: What's your job title?
- qid: QManagerFollow
type: single
text: How big is your team?
if: "manager" in QRole.value.lower() or "lead" in QRole.value.lower()
options:
1: 1–4
2: 5–9
3: 10+
open answers are unstructured, but you can still route on them with
substring checks. lower() normalises so “Manager” / “manager” /
“MANAGER” all match.
Validation example — phone number
- qid: QPhone
type: open
text: Phone number (US format)
input.maxChar: 20
validation: |
import re
cleaned = re.sub(r"[\s\-\(\)\+]", "", QPhone.value or "")
if not re.fullmatch(r"\d{10,11}", cleaned):
fail("Please enter a valid US phone number (10 digits).")
re.sub strips formatting characters before checking the digit
count. Validation runs after the respondent submits — calling
fail() rejects the answer and shows the message.
Export
open exports as a single column:
| What | Column |
|---|---|
| The typed text | qid (e.g. QFeedback) — string |
Empty answers (when required: False and the respondent leaves it
blank) export as an empty string "", not null.
See also
- openList — multiple text inputs per question, one per row.
- number — single numeric input.
- Constraints —
validation,input.maxChar. - Layout & input —
input.size,input.rows. - Builtins & operators — full string method list, regex.
- Piping — using
Q.valuein displayed text.