Текст
Тип въпрос за свободен текстов отговор в rtSurvey
The text question type collects a free-text response — any string of characters. It is the most flexible input type and is used for names, addresses, descriptions, codes, and anything that does not fit a more specific type.
rtSurvey also extends text with time input widgets that allow precise time entry with a clock picker.
Basic XLSForm Specification
| type | name | label |
|---|---|---|
| text | respondent_name | Full name of respondent |
| text | address | Home address |
For more details on the standard XLSForm text type, see the XLSForm specification.
Uses
Text questions are used for:
- Names, addresses, free descriptions
- Open-ended comments or feedback
- Codes, IDs, or reference numbers that do not fit integer/decimal
- Collecting time values with rtSurvey’s time input extensions
- Autocomplete text fields (via
search-autocomplete-noedit-v2())
Standard appearance options
| Appearance | Description |
|---|---|
| (none) | Single-line text input |
multiline | Multi-line text area — best for longer free text on web |
rtSurvey time input extensions
rtSurvey extends text with a clock picker widget for collecting time values. These appearance options display a clock icon the enumerator can tap to select hours, minutes, seconds, or milliseconds.
Appearance variants
| Appearance | Description |
|---|---|
inline | Clock icon displayed next to the field |
inline colors("RRGGBB") | Clock icon with custom hex color |
inline-1line | Clock displayed in a compact single-row format |
inline-1line-RRGGBB | Single-row with custom icon color (hex, no #) |
inline-1line colors("RRGGBB","RRGGBB") | Single-row with two colors |
inline-onlyresult | Clock icon disappears after selection; only the value is shown |
inline-onlyresult colors("RRGGBB") | Same, with custom icon color |
Time format tokens
Append a format string in brackets to control which time components are shown:
| Format string | Displays |
|---|---|
inline-[%H:%M] | Hours and minutes (24-hour) |
inline-[%h:%M] | Hours and minutes (12-hour) |
inline-[%H:%M:%S] | Hours, minutes, seconds (24-hour) |
inline-[%h:%M:%S] | Hours, minutes, seconds (12-hour) |
inline-[%H:%M:%3] | Hours, minutes, milliseconds |
inline-[%M:%S] | Minutes and seconds only |
inline-[%M:%3] | Minutes and milliseconds only |
inline-[%S] | Seconds only |
inline-[%3] | Milliseconds only |
inline-[%H] | Hours only (24-hour) |
inline-[%h] | Hours only (12-hour) |
Example: Record a task duration in minutes and seconds
| type | name | label | appearance |
|---|---|---|---|
| text | task_duration | Time taken to complete the task | inline-[%M:%S] |
Example: Record an event time in 24-hour format with custom color
| type | name | label | appearance |
|---|---|---|---|
| text | event_time | Time of event | inline-1line colors("0099FF") |
Data format
Text data is stored and exported as a plain string. For time-based inputs using the inline clock widget, the value is stored in the format matching the chosen format string (e.g., 14:32 for %H:%M).
Constraints and validation
Apply constraints to enforce format, length, or pattern:
| type | name | label | constraint | constraint_message |
|---|---|---|---|---|
| text | name | Full name | string-length(.) >= 2 | Name must be at least 2 characters |
| text | code | Reference code | regex(., '^[A-Z]{2}[0-9]{4}$') | Enter 2 uppercase letters followed by 4 digits |
| text | phone | Phone number | regex(., '^[0-9]{9,15}$') | Enter a valid phone number |
Best Practices
- Use more specific types (
integer,decimal,date) whenever the data has a known structure — this prevents invalid entries and simplifies analysis. - Add
constraintwithstring-length()orregex()to validate codes or IDs. - Use
multilineappearance for open-ended questions where respondents may write several sentences. - For time collection, choose the time format tokens that match the precision your analysis requires — collecting milliseconds when you only need minutes wastes enumerator effort.
Platform support
The text question type and all time input appearances are supported on iOS, Android, and web platforms.
Limitations
- Text responses are free-form — there is no built-in spell check or vocabulary constraint beyond regex patterns.
- The inline time widget is an rtSurvey extension and is not part of the standard XLSForm specification.