isValid - Methods - Questions API

Questions API Methods

isValid()

Returns whether or not the response of the question instance passes validation.

When withPartials is false or does not pass any argument, it returns whether the response is valid or not. If the question can't be validated (e.g. if there's no response), then it returns null.

When withPartials is true, it returns a detailed object on the validity of the response. The object contains the following variables:

  • correct (boolean): a true/false value indicating if the answer is correct or incorrect.
  • partial (array/object/array of arrays): a map of each response to a boolean, indicating if it is correct or not.

Arguments

  • withPartials boolean

  • callback function

    Optional. Callback that must be used for asynchronous Question types.

    • isValid boolean | object | null

      As per return description above.

Return value

Type boolean | object | null

Was this article helpful?

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