Survey, then pass {"survey": {"presentation": "group"}} to .humanize().
This guide describes the API introduced in PR #2623. It requires an EDSL version containing that change and a hosted Humanize implementation that supports grouped presentation. The PR adds the schema option and navigation API; it does not include the hosted UI implementation.
Create a two-page survey
This example puts two background questions on the first page and two feedback questions on the second.
Preview with the same schema you intend to use when creating the survey:
presentation, or set it to "question", for the default question-by-question mode.
Set group boundaries
survey.add_question_group(start_question, end_question, group_name) accepts question names or question objects and returns the survey for chaining.
- Each group includes both endpoints and every question between them.
- Groups must not overlap. A one-question page uses the same question for both endpoints.
- Names must be unique Python identifiers, such as
background, and must not match a question name. - Pages follow question order in the survey.
- Assign every question you want displayed to a group. With groups defined, the current grouped navigator skips questions outside those groups.
work_location, define its group with survey.add_question_group("work_location", "work_location", "location_page") on a survey where that question is not already grouped.
Plan branching around pages
The navigator uses the answers supplied when a page is requested to filter skipped questions. After a page is submitted, it applies the normal navigation rules from that group’s last renderable question to choose the next page. Put page-level jump or stop rules on that question. If a later question depends on an earlier answer, put the dependent question on a later page so that answer is available when the page is selected. The navigation API does not establish live, within-page updates to conditional questions. For example, starting with the two-page survey above, omit the improvement question for satisfied respondents:- A group with no remaining questions is skipped.
- A jump into the middle of a group starts at the target question; earlier questions in that group are omitted.
- Relevant instructions before or within the selected group are included by default.
Inspect navigation locally
Survey authors normally define groups and call.humanize(). For debugging or implementing a renderer, survey.next_group() returns the next page without creating a hosted survey.
Using the original two-page example, before the branching modification:
include_instructions=False to return questions only.
See Humanize for retrieving responses and Humanize schema for styling and other presentation options.
