Creates a page where the participant puts their answer in a text box.
text_input_page(
label,
prompt,
one_line = TRUE,
save_answer = TRUE,
placeholder = NULL,
button_text = "Next",
width = "300px",
height = "100px",
validate = NULL,
on_complete = NULL,
admin_ui = NULL
)
Label for the current page (character scalar).
Prompt to display (character scalar or Shiny tag object).
Whether the answer box only has one line of text.
Whether or not to save the answer.
Placeholder text for the text box (character scalar).
Text for the submit button (character scalar).
Width of the text box (character scalar, should be valid HTML).
Height of the text box (character scalar, should be valid HTML).
Optional validation function.
The argument list should include ...
,
and any of:
answer
, the participant's most recent answer;
state
, the participant's state object;
input
, the current page's Shiny input object;
opt
, the test's option list as created by test_options()
;
session
, the current Shiny session object.
It should return TRUE
for a successful validation;
for an unsuccessful validation, it should return either FALSE
or a character scalar error message.
If validation fails then the page will be refreshed, usually
to give the user a chance to revise their input.
Optional function to execute on leaving the page
(after successful validation).
The argument list should include ...
,
and any of:
state
, the participant's state object;
answer
, the participant's most recent answer;
input
, the current page's Shiny input object;
session
, the current Shiny session object;
opt
, the test's option list as created by test_options()
.
Optional UI component for the admin panel.