beforeValidate - Events - Questions API

Questions API Events


This event fires when the learner clicks on the 'check answer' button, before the Question is validated, and before the validation UI is rendered.

You would want to be notified about this event firing, because you may want to display a hint to the learner before displaying the validation result (i.e. ticks or crosses), for example.

Note This can also fire when the validate public method is called.

Note If this event is listened to, developer can prevent the validation from happening by calling event.preventDefault().


itemsApp.question('[my_response_id]').on('beforeValidate', function (event) {
    console.log('This code executes when the learner has entered or selected a response.');

    // console.log('Prevent the validation UI from being shown.');
    // event.preventDefault();

Callback arguments

  • event object

    Calling event.preventDefault() to prevent the validation from running.

Related articles

  • The validated event, the event that occurs when the response validation has completed.
Was this article helpful?

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