Skip to content

Questionary Step

martinkonopka edited this page Aug 21, 2018 · 9 revisions

Display a questionary form to the participant with questions of two type:

  • Text input answer - displays text box for input,
  • Choose answer - list of answers, each with checkbox.

Answers to question may be constrained, e.g., with regular expression for text input or maximum number of selected choices.

If the questionary contains any question marked as required, the participant may complete the questionary step only if all required questions are correctly answered.

Each questionary and its questions may be identified with id. This is used for storing and retrieving answers during the session recording.

Definition

  • actionType : "Questionary" (required)
  • id : string - identifiaction of the questionary.
  • questions : QuestionActionSettings[] - array of questions contained in this questionary:
    • actionType : string - answer type, see below.
    • id : string - identification of the question, used to identify the answer in the result and SessionRecording settings.
    • question : string - text of the question.
    • helpText : string - help text displayed when the participant fails to answer the question.
    • isRequired : boolean - specifies whether the question must be answered in order to continue in the sessions.
    • Other settings specific to each answer type. Currently, these are supported:
      • Text input answer
        • actionType : "WriteQuestionAnswer"
        • validAnswerRegexPattern : string - if not empty and isRequired is set to true, the regex pattern is used to check for correctness of the answer.
        • isMultiline : boolean - if true the input field accepts text wrapping.
          • default value: false
        • width : double - sets the width of the input field.
        • height : double - sets the height of the input field, works for multiline input only.
      • Choose answer
        • actionType : "ChooseQuestionAnswer"
        • answers : string[] - array of available answers for the question.
        • limit : int - maximum number of answers which the participant may choose.

Instructions step can be styled with these additional settings, see Content Step styling for more details.

  • foreground : Color (optional) - text foreground color.
    • default value: "white"
  • background : Color (optional) - background color.
    • default value: "black"
  • fontSize : number
    • default value: 24

Result

  • resultType : "Successful" - if the questionary was completed.
  • answers : QuestionAnswer[] - array of answers to each question in the questionary:
    • questionId : string
    • answer : string
      • For WriteQuestionAnswer, the participant's answer.
      • For ChooseQuestionAnswer, concatenated indices of selected answers, separated with comma ,.

Examples

Show questionary with questions about participant:

  • Name, cannot be empty.
  • Age, constrained by the regex pattern to accept only valid age values.
  • Choice for 3 favorite colors. Questionary is completed by clicking on the Submit button, thus it is not needed to specify completion.
{
    "action": {
        "actionType": "Questionary",
        "id": "UserDetails",   
        "questions": [
            {
                "actionType": "WriteQuestionAnswer",
                "id": "Name",
                "question": "Your name",
                "isRequired": true
            },
            {
                "actionType": "WriteQuestionAnswer",
                "id": "Age",
                "question": "Your age",
                "validAnswerRegexPattern": "[1-9][0-9]{0,2}"
            },
            {
                "actionType": "ChooseQuestionAnswer",
                "id": "Colors",
                "question": "Choose your favorite colors (max. 3)",
                "isRequired": true,
                "limit": 3,
                "answers": [ "Red", "Blue", "Green", "Black", "Yellow" ]
            }
        ]
    }
}

Result for this questionary with answers:

  • Name: John Locke
  • Age: 48
  • Colors: Red, Green, Yellow
{
    "answers": [
        {
            "QuestionId": "Name",
            "Answer": "John Locke"
        },
        {
            "QuestionId": "Age",
            "Answer": "48"
        },
        {
            "QuestionId": "Colors",
            "Answer": "0,2,4"
        }
    ],
    "resultType": "Successful"
}
Clone this wiki locally