responses
: An array that stores all question responses.surveyDetails
: An object that stores metadata about the survey.collectPageData
method.responses
array using the updateData
method.responses
array has the following structure:
questionId
(string): The ID of the questionquestionId
(string): The ID of the questionboolean
: True if the question has been answered, false otherwiseresponses
array.Returns:array
: An array containing all responsesobject
: An object with surveyDetails
and responses
propertiessurveyDetails
object. This includes:
startTime
: When the survey beganendTime
: When the survey was completedkey
(string): The key for the survey detailvalue
(any): The value to set for the survey detailkey
(string): The key of the survey detail to retrieveendTime
is recorded in surveyDetails
.options
(object): An object containing the finishing options
message
(string): The message to display upon survey completionvalidateCurrentPage
method checks the validity of all elements on the current page.validate
method that can be customized.validate
method when creating custom question types. This allows you to define specific validation rules for each element type.
Here’s an example of how to implement custom validation for a rating question:
validate
method checks if a response has been given (this.data.response !== undefined
) and if it’s within the valid range (>= 1
and <= this.maxRating
).showError
is true and the validation fails, it displays an error message using this.showValidationError()
.validate
method.
super.validate(showError)
if you want to retain the base validation logic from the parent class.
By implementing custom validation, you can ensure that the data collected in your survey meets your specific requirements and quality standards.