Question type

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.

Mockup preview
QFeedback open textarea
Anything else you'd like to share?
- qid: QFeedback
    type: open
    text: Anything else you'd like to share?
    style: textarea
    input.rows: 5

Properties

PropertyValuesNotes
qidstringRequired. Unique within the survey.
typeopenRequired.
title, text, instructionrenderableVisible content. Use {{ }} to pipe runtime values. HTML allowed.
requiredTrue | FalseDefault True.
default.errorsTrue | False | custom stringDefault True.
validationcode blockPython; call fail() to reject invalid input. No default.
readonlyTrue | FalseDefault 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.
visibilityshow | hideDefault show.
styletext | textareaDefault text.
input.sizeintegerWidth of the input box in characters. Default sizes itself to the container.
input.rowsintegerVisible rows for style: textarea. Default 4. Ignored for style: text.
input.maxCharintegerMaximum allowed text length. No default — unlimited unless set.
input.minCharintegerMinimum required length. No default.
input.sourcedefault | jsDefault default (respondent-entered). Set js for JS / system-fed values.
customcode blockCustom runtime block. No default.

Methods & accessors

open is the simplest type — a single string. The runtime surface mirrors that.

Accessors

ExpressionReturnsMeaning
Q.valuestrThe typed text. Empty string when unanswered.
Q.answeredboolTrue once the respondent has typed at least one character (or set the value via script).
Q.notAnsweredboolInverse of answered.

Methods

ExpressionReturnsMeaning
Q.set("hello")NoneSet the value to a string. Used in scripts for hidden helpers or JS-fed prefill.
Q.set("")NoneSet to empty string. Same effect as Q.reset() for most purposes.
Q.reset()NoneClear 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:

ExpressionReturnsMeaning
len(Q.value)intLength of the typed text.
Q.value.strip()strWhitespace trimmed from both ends.
Q.value.lower()strLowercased.
Q.value.upper()strUppercased.
Q.value == "yes"boolDirect string comparison.
"yes" in Q.valueboolSubstring containment.
Q.value.startswith("Q")boolPrefix check.
Q.value.endswith(".")boolSuffix check.
re.match(pattern, Q.value)match | NoneRegex 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)
Type your answer… |
Single-line input. Best for short answers — names, codes, single words, email addresses.
textarea Textarea
Type a few sentences here… |
Multi-line input. Use input.rows to control height. Best for paragraphs of feedback or longer comments.

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.

Mockup preview
QFeedback open textarea
What did you think of the experience?
Live state
QFeedback.answeredFalse
QFeedback.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.

Mockup preview
QFeedback open text
Tell us in your own words.
Methods & accessors — live
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:

  • value is a string, always. Even an empty input returns "", not None. Compare to single, where value is a Code (number) or None.
  • answered flips to True as soon as there’s at least one character. Use len(value.strip()) > 0 if you want to treat whitespace-only as unanswered.
  • len(value) is the workhorse for validation — most “must type at least N characters” rules are just len(value) >= N.
  • String methods chain: value.strip().lower() is a normalised comparison-ready form.

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:

WhatColumn
The typed textqid (e.g. QFeedback) — string

Empty answers (when required: False and the respondent leaves it blank) export as an empty string "", not null.

See also