Skip to content

Questionary Step

Martin Konopka edited this page Mar 6, 2019 · 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 : Text - text of the question. Value in this field can be either a single string value or array of strings, which will be concanetad with new line character.
    • helpText : string - help text displayed under the question, if this question is required and the participant's answer was not valid.
    • 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 : "WriteAnswerQuestion"
        • 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 (isMultiline set to true).
      • Choose answer
        • actionType : "ChooseAnswerQuestion"
        • answers : string[] - array of available answers for the question.
        • limit : int - maximum number of answers which the participant may choose.
        • minimum: int (optional) - minimum number of answers that must be chosen. If omitted (or null value is passed), defaults to 1, if isRequired is set to true; otherwise, 0.

Questionary step is a content step, it can be configured with additional settings common for all content steps. See Content Step styling for details. Because questionary requires participant's interaction, the showCursor setting has no effect.

Result

  • resultType : "Successful" - if the questionary was completed.
  • answers : QuestionAnswer[] - array of answers to each question in the questionary:
    • questionId : string
    • answer : string
      • For WriteAnswerQuestion, the participant's answer.
      • For ChooseAnswerQuestion, 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": "WriteAnswerQuestion",
                "id": "Name",
                "question": "Your name",
                "isRequired": true
            },
            {
                "actionType": "WriteAnswerQuestion",
                "id": "Age",
                "question": "Your age",
                "validAnswerRegexPattern": "[1-9][0-9]{0,2}"
            },
            {
                "actionType": "ChooseAnswerQuestion",
                "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