Initialization Option Author API

require_validation

Controls whether an author must add a correct answer to a Question prior to saving.

You would want to use this to require authors to add a correct answer before saving. This eliminates the case where the Questions are authored without answers.

This will only be applicable to Question types that have "Auto scoring" enabled.

Examples

// Force authors to add answers for Questions before saving
var initializationOptions = {
    "config": {
        "widget_templates": {
            "require_validation": true
        }
    }
};

Values

Request object key config.widget_templates.require_validation

Default: false

Type boolean

Caveats

Note The "Set correct answer(s)" section of the Widget editor must be enabled for this option to take effect. This section may be hidden via the editor's custom global template or base_question_type initialization options.

Was this article helpful?