Create a free text response question

question_text(
  prompt,
  placeholder = "",
  rows = 1,
  columns = 40,
  required = FALSE,
  name = NULL
)

Arguments

prompt

The prompt for the question

placeholder

A string specifying the placeholder text

rows

Number of rows spanned by the text box

columns

Number of columns spanned by the text box

required

Is a response to the question required?

name

A convenient label for the question

Value

A question object to be passed to trial_survey_text().

Details

The question_text() function is designed to be called when using trial_survey_text() to construct a survey page that contains free text response items. When rendered as part of the study, the text specified by the prompt argument is shown to the participant, with a text box placed underneath into which a response may be typed. The size of the text box can be customised by specifying the number of text rows and columns. If a placeholder string is specified (e.g., placeholder = "Type your answer here") it is displayed in faded text within the box, and will disappear as soon as the participant begins typing the response.

If required = TRUE the participant will not be allowed to continue to the next trial unless an answer is provided.

The name argument should be a string that provides a convenient label for the question. If left unspecified, jsPsych defaults to labelling the questions within a survey page as "Q0", "Q1", "Q2", etc.

See also

Survey page trials are constructed using the trial_survey_text, trial_survey_likert, trial_survey_multi_choice and trial_survey_multi_select functions. Individual questions for survey trials can be specified using question_text, question_likert and question_multi.