Short text shorttext

Short text (shorttext)

The short text Question is referenced by its Question type in the code, which is shorttext. This Question allows students to respond to Questions that have short, definite answers, for example, 1-2 words, or a number.

Examples

{
    "response_id": "60002",
    "type": "shorttext",
    "stimulus": "What is the capital of Ireland?",
    "instant_feedback": true,
    "case_sensitive": true,
    "validation": {
        "scoring_type": "exactMatch",
        "valid_response": {
            "value": "Dublin"
        },
        "alt_responses": [{
            "value": "Dubh Linn",
            "score": 2
        }, {
            "value": "Baile Átha Cliath",
            "score": 3
        }, {
            "value": "Baile Atha Cliath",
            "score": 4
        }]
    }
}

Attributes

  • is_math boolean

    Set to true to have LaTeX or MathML contents to be rendered with mathjax.

    Default: false

  • metadata object

    Object containing additional information about the question.

  • metadata.distractor_rationale string

    Used to display individual response feedback/rationale to the student.

  • metadata.rubric_reference string

    A unique identifier for the rubric to be used with the question - defaults to course rubric if assigned in activity

  • metadata.sample_answer string

    A sample answer to be displayed on the Learnosity Reports API. HTML is supported.

  • metadata.acknowledgements string

    References for any text passages, documents, images etc. used in the question.

  • stimulus string

    The question stimulus. This can include text, tables, images, resources and LaTeX entered via the Math Editor.

  • stimulus_review string

    HTML/Text content displayed only in review state rendered above the response area. Supports embedded Feature <span> tags. Will override stimulus in review state.

  • instructor_stimulus string

    HTML/Text content displayed when showInstructorStimulus is set to true on the activity. Supports embedded Feature <span> tags.

  • type string

    Type of question being asked, e.g. 'association'

    Default: "shorttext"

  • ui_style object

    Object used to control different aspects of the UI

  • ui_style.fontsize string

    Controls the size of base font for this question. Options are among 'small', 'normal', 'large', 'xlarge' and 'xxlarge'.

    Default: "normal"

  • feedback_attempts number

    If instant_feedback is true, this field determines how many times the user can click on the 'Check Answer' button. 0 means unlimited.

    Default: 0

  • instant_feedback boolean

    Flag to determine whether to display a 'Check Answer' button to provide instant feedback to the user.

    Default: false

  • validation object

    In this section, configure the correct answer(s) for the question.

  • validation.allow_negative_scores boolean

    Negative scores will be normalised to zero by default. Allowing negative scores, on the other hand, means that the score can drop below zero when penalties are applied.

    Default: false

  • validation.penalty number

    Value indicating the marks deducted for an incorrect response.

    Default: 0

  • validation.min_score_if_attempted number

    Positive value indicating the minimum score if a student attempted the question.

    Default: 0

  • validation.scoring_type string

    The way in which marks are distributed for the question.

    • Exact Match - All parts of the question must be answered correctly to receive a mark.
    • Partial Match Per Response - Each correct response element will be awarded an individual score.
    • Partial Match - Each correct response element will be scored individually, and the overall question score will be divided between responses.

    Default: "exactMatch"

  • validation.unscored boolean

    When enabled, this option will remove all scoring from the question. This is useful for creating practice questions.

    Default: false

  • validation.valid_response object

    An object containing the valid response score and value.

  • validation.valid_response.score number

    Score awarded for the correct response(s).

    Default: 1

  • validation.valid_response.matching_rule string

    Matching rule that will be used to evaluate student's input

    Default: "exact"

  • validation.valid_response.value string

    Default: ""

  • validation.automarkable boolean

    Defines whether the question will be marked automatically, or must be marked manually.

    Default: true

  • validation.alt_responses array

    Add an alternate response if there is more than one correct overall solution to a question.

  • validation.alt_responses[ ].score number

    Score if the alternative response is correct.

    Default: 1

  • validation.alt_responses[ ].matching_rule string

    Matching rule that will be used to evaluate student's input

    Default: "exact"

  • validation.alt_responses[ ].value string

    Default: ""

  • validation.alt_responses[ ][ ].score number

    Score if the alternative response is correct.

    Default: 1

  • validation.alt_responses[ ][ ].matching_rule string

    Matching rule that will be used to evaluate student's input

    Default: "exact"

  • validation.alt_responses[ ][ ].value string

    Default: ""

  • validation.enable_fullwidth_scoring boolean

    For languages such as Japanese, where full-width and half-width characters are used, validate responses with either type of character width. For example, in this question: What do we call '犬' in English? And you have set 'Dog' (full-width) as the correct answer, if the learner enters 'Dog' (full-width) or 'Dog' (half-width) these will both be marked as correct responses when this option is enabled.

    Default: false

  • description string

    Deprecated See stimulus_review.
    Description of the question and its context to be displayed. It supports HTML entities.

  • max_length number

    Maximum number of characters that can be entered in the field. Maximum value is 250. For longer questions use longtext type.

    Default: 50

  • character_map boolean / array [characters]

    If true, the character map button will display within the short text field. The character map will display the default set of special characters.
    If an Array, the character map button will show and display only the array of characters.
    IMPORTANT The HTML document will require a charset of utf-8: <meta charset="utf-8">

    Default: false

  • spellcheck boolean

    Control the input/textarea attributes spellcheck, autocapitalize, autocomplete and autocorrect. See "Spell check MDN". "Autocapitalize MDN". "Autocomplete MDN" " Autocorrect ". Note these are browser features and may not always be available.

    Default: false

  • placeholder string

    Placeholder text that can be added into the response entry area, which disappears when user starts typing.

  • case_sensitive boolean

    If true, responses will be compared against valid_responses considering the letters' case.

    Default: false

  • ignore_leading_and_trailing_spaces boolean

    Determines whether the automatic marking will ignore leading and trailing spaces. E.g. 'a' and ' a ' will be treated as the same.

    Default: true

  • response_container array [response container object]

    Array containing objects defining each individual response container style.

  • response_container.input_type string

    Type of input

    Default: "text"

  • response_container.aria_label string

    The ARIA label for the response container. It will have a default value if no label is provided.

Response format

The data returned in the response format for this Question is the short text response, entered by the student.

Response format examples

{
    "value": "New Jersey",
    "characterCount": 10,
    "type": "string",
    "apiVersion": "v2.173.0",
    "revision": 2,
    "feedbackAttemptsCount": 1
}

Response attributes

  • value string

    The short text response, entered by the student.

  • characterCount numeric

    The number of characters entered by the student.

  • type string

    Informs the scoring engine about what kind of data to expect in the values entered by the student. For this Question type, you must always supply a string for this attribute with the value "string".

  • apiVersion string

    The version of the Questions API that returned this response.

  • revision numeric

    Keeps track of the number of Question attempt submissions, i.e. how many times the student answered the Question and submitted it.

  • feedbackAttemptsCount numeric

    Keeps track of the number of feedback attempts.

Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.