Survey: how it is made
Survey is a short three-step questionnaire: one answer, a name and a number, and a consent. Required fields, a number field and a button that stays disabled until the form is filled. This page shows where each of these lives in the editor and how to repeat it.
You get Survey by copying it from the gallery of ready apps (Getting started). Survey has no theme of its own and no images: it uses the standard theme and the standard data dictionary of the project.
The screens#
| Screen | What it is | Where it leads |
|---|---|---|
Step 1: one answer |
A choice group with the goal of the person | Next: Step 2: text and a number |
Step 2: text and a number |
A name, an age and a free comment | Next: Step 3: consent |
Step 3: consent |
A checkbox and the send button | Thank you |
Thank you |
The end | Start over goes back to the first screen |
Each screen has Survey top bar, a text with the number of the step and its own pinned button at the bottom.
How a field writes the answer#
Every field of a form writes to a data field of the dictionary, and that is where the other widgets read it from. Select Name field and look at Writes to: it holds survey.name. Goal choices (a Choice group) writes to survey.goal, Age field to survey.age, Consent checkbox to survey.agreed.
To repeat: add a Text field, choose its Writes to from the list of the dictionary fields of the right type and fill in its Label. A field that does not write anywhere keeps nothing, so the editor asks for the field when the widget is required.
How a field becomes required#
Goal choices, Name field, Age field and Consent checkbox have Required turned on. The screen does not forget the rule: the form of a screen is all the required fields on it that are visible and not disabled.
How the number field is made#
Age field is a Text field with Value type set to Number. The app accepts only a number: a person who types letters leaves the field not filled, and the field writes an empty value, never a zero. The answer reaches the data as a number, so a condition can compare it: “less than 16”.
To repeat: add a Text field, set Value type to Number, choose a number field as Writes to and, if you want, a Keyboard.
How the button waits for the form#
Next button has Disabled until the required fields are filled turned on. As long as one required field of the screen is empty, the button is dim and does nothing — it sends neither the action nor the analytics event. It stays in the order of focus, so a person with a screen reader can still find it. Next button is Pinned to the bottom: it stays visible under a long form and above the keyboard.
To repeat: turn on Required on the fields, then Disabled until the required fields are filled on the button.
How a rule on the answer is made#
On Step 3: consent two widgets watch the age from step 2:
Age noteis Conditional: it is shown when the data fieldsurvey.ageis less than 16 and says the survey is for people of sixteen and older.Send answers buttonhas both Disabled until the required fields are filled and Disabled if… the same condition. The button wakes up only when the consent is ticked and the age is allowed.
To repeat: open Visibility on a note and Disabled if… on a button and give both the same condition on one field.
How the end of the flow is made#
The buttons use Go to screen. Start over button on Thank you uses Switch to a section to the first screen: this resets the stack of screens, so “back” does not return to the answered form.
Data#
Survey uses the fields survey.goal, survey.name, survey.age, survey.comment and survey.agreed of the standard dictionary. All of them are written by the person on the phone; the app that shows the screen receives each answer as it is typed.
Above the canvas open the Scenario list and choose Configure values…: set survey.age to a value below 16 and see Age note appear on step 3 and the button dim; set survey.goal to No data to see an unanswered form. All states shows these cases side by side. The Preview tab lets you fill the form like a person would. More: Data, Actions and navigation.