-
Notifications
You must be signed in to change notification settings - Fork 1
08. Forms and question widgets
Berit edited this page Feb 12, 2024
·
1 revision
As mentioned before, a Trial
may contain a Form
, which present one or more questions to the user. We have a choice of multiple question widgets:
An example of how a question is initialized in the Python backend:
question = RadiosQuestion(
key=key,
question=_('Does this sound like song or speech to you?'),
choices=[
_('sounds exactly like speech'),
_('sounds somewhat like speech'),
_('sounds neither like speech nor like song'),
_('sounds somewhat like song'),
_('sounds exactly like song')],
result_id=prepare_result(key, session, section=section, scoring_rule='LIKERT')
)
The key
is a short name of the question. With every question, we also send a result_id
. This means we can already register information in the database, such as (in this case) the section this question refers to, or the scoring rule by which we assign a score after the participant gives a response.
After defining the question above, we can then wrap it in a form as follows:
form = Form([question])