This is a lower-level API. Lower-level APIs are not recommended for most projects, and may not be available on all plans. See our page on recommended deployment patterns for more information.
Public Method Questions API

resetResponse()

Note Custom Questions do not support resetResponse(). If you want to achieve reset response functionality with a Custom Question, see this Creating Custom Questions tutorial article. You would need to build your own logic to implement reset features with Custom Questions.

Note The resetResponse() will not reset other states which are not part of responses. For example, Check Answer attempts.

Resetting the response of a question if it has a response object:

  1. Clear the response value by setting it back to null.
  2. Add a flag called resetState : reset to the response object.
  3. Clear the Question UI.

After resetting the response, if you attempt the Question again, the flag resetState should change from resetState:reset to resetState:attemptedAfterReset.

When you call the getResponses() public method, the response object should look like the following examples.

Examples

// When you call the getResponse() public method before resetting the response of a Question
{
    value: ["hello"],
    type: "array",
    apiVersion: "v2.191.0",
    revision: 1
}
// When you call the getResponse() public method after resetting the response of a Question
{
    value: null,
    type: "array",
    apiVersion: "v2.191.0",
    revision: 2,
    resetState: "reset" <-- a flag added
}
// Attempting the Question again after resetting the response
{
    value: [
        "2"
    ],
    type: "array",
    apiVersion: "v2.191.0",
    revision: 2,
    resetState: "attemptedAfterReset" <-- the flag changed
}

Arguments

None.

Return value

None (undefined).

Versioning

Version added:  v2023.1.LTS

Was this article helpful?