There are five methods used to define a custom question. Each S3 method
should correspond to the type = TYPE
supplied to the question.
question_ui_initialize.TYPE(question, value, ...)
Determines how the question is initially displayed to the users. This should return a shiny UI object that can be displayed using shiny::renderUI. For example, in the case of
question_ui_initialize.radio
, it returns a shiny::radioButtons object. This method will be re-executed if the question is attempted again.
question_ui_completed.TYPE(question, ...)
Determines how the question is displayed after a submission. Just like
question_ui_initialize
, this method should return an shiny UI object that can be displayed using shiny::renderUI.
question_is_valid.TYPE(question, value, ...)
This method should return a boolean that determines if the input answer is valid. Depending on the value, this function enables and disables the submission button.
question_is_correct.TYPE(question, value, ...)
question_ui_try_again <- function(question, value, ...)
Determines how the question is displayed to the users while the "Try again" screen is displayed. Usually this function will disable inputs to the question, i.e. prevent the student from changing the answer options. Similar to
question_ui_initialize
, this should should return a shiny UI object that can be displayed using shiny::renderUI.
Usage
question_ui_initialize(question, value, ...)
question_ui_try_again(question, value, ...)
question_ui_completed(question, value, ...)
question_is_valid(question, value, ...)
question_is_correct(question, value, ...)
# S3 method for default
question_ui_initialize(question, value, ...)
# S3 method for default
question_ui_try_again(question, value, ...)
# S3 method for default
question_ui_completed(question, value, ...)
# S3 method for default
question_is_valid(question, value, ...)
# S3 method for default
question_is_correct(question, value, ...)
Arguments
- question
question object used
- value
user input value
- ...
future parameter expansion and custom arguments to be used in dispatched s3 methods.