mapValidationMetadata - Methods - Questions API

Questions API Methods

mapValidationMetadata()

Returns metadata for the question instance mapped to responses. This should only be used on validatable questions that can have multiple response areas. The metadata being mapped should be an array within metadata. For information about using this function to display distractor rationale, view this tutorial.

If successful, returns an object literal containing arrays that are keyed by "correct", "incorrect", and "unattempted". Each item in these arrays is an object that contains value property that holds the response value; an index property that refers to the shared index of both the response area and the metadata value; and metadata property that contains the metadata value.

Returns false if the all the necessary data doesn't exist, e.g. non-existent metadata, or question does not contain multiple response areas, etc.

Note For more information, see this tutorial article.

Arguments

  • metadata_key string

  • callback function

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

    • result MappedValidationMetadata

      As per return description above.

Return value

Type object

  • correct ValidationMetadata

  • incorrect ValidationMetadata

  • unattempted ValidationMetadata

Type definitions

  • ValidationMetadata array

Was this article helpful?

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