Responses in Experiments
Experiments
Testable supports a wide range of response types for experimental trials. Use the buttons column for on-screen buttons, the key column for keyboard responses, or the responseType column for richer response widgets like sliders, text boxes, and drag-and-drop.
Survey question types are covered in Survey Response Types.
Button responses
Section titled “Button responses”Create on-screen buttons with custom labels.
Column: buttons
Values: button labels separated by semicolons
buttons = Yes; No; Not sure- You can define up to 12 buttons (
button1throughbutton12) - Buttons can be used for advancing to the next trial (e.g. for instructions) or to record responses from participants (e.g. “Same”, “Different”, “Next”)
- Testable numbers buttons from left to right starting at 1, so
responseCodein results will be1,2, or3for the example above
Keyboard responses
Section titled “Keyboard responses”Enable specific keyboard keys as valid responses.
Column: key
Values: key labels separated by spaces
key = f jf jwill enable the keys F and J1 2will enable the keys 1 and 2- Special keys are supported:
space,enter,left,right,up,down - Use
allto allow responding with any standard key on the keyboard - Key combinations and modifier keys are supported:
Ctrl+S,Shift+A,Alt+left
If you leave buttons empty and don’t specify key, any key press will advance the trial.
Allowing multiple keyboard inputs
Section titled “Allowing multiple keyboard inputs”You can define how many keyboard responses are required or allowed in a single trial.
Column: responseOptions (used with key)
Values: min:number;max:number
- If
minis set, participants must press at least that many valid keys before they can continue - A button to advance appears only after the minimum is reached
- When the maximum number of presses is reached, the experiment advances automatically
Examples:
min:2;max:4requires the participant to press 2 to 4 keysmax:4accepts up to 4 key presses; the trial ends when 4 are reached or if the user presses ‘Confirm’
The key column also defines the correct response for accuracy scoring. See Defining correct responses below.
Other response types (responseType)
Section titled “Other response types (responseType)”The responseType column enables richer response modes beyond buttons and keyboard.
Text boxes (box)
Section titled “Text boxes (box)”Allow participants to type free-text responses.
Column: responseType
Value: box or box*number (e.g. box*3 for three text boxes)
- Multiple boxes are centered horizontally below any stimuli by default
- You can have more or fewer boxes than the number of stimuli
- You can position boxes manually using the
responsePoscolumn (see Positioning text boxes)
On type = form rows, box renders a survey text input instead; see Survey Response Types.
Positioning text boxes
Section titled “Positioning text boxes”Use responsePos together with responseType = box*number to control where text boxes appear relative to stimuli.
Column: responsePos
Values: below, above, left, right
- Defines the position of the box(es) relative to the stimuli
- Example:
responseType = box*2andresponsePos = left;rightshows one box to the left of the stimulus and another to the right
Multi-line text area (comment)
Section titled “Multi-line text area (comment)”A multi-line text area for longer free-text responses.
Column: responseType
Value: comment
On type = form rows, comment renders a survey text area instead; see Survey Response Types.
Sliders (slider)
Section titled “Sliders (slider)”Display a horizontal slider scale. By default, the slider ranges from 0 to 100 with step size 1.
Column: responseType
Value: slider
On type = form rows, slider renders as a survey question; see Survey Response Types for the differences (for example, how untouched form sliders are recorded).
Customising sliders
Section titled “Customising sliders”Use the responseOptions column to control slider range, step size, starting position, and appearance.
Column: responseOptions (used with responseType = slider)
Syntax: min_max_step;start;flags
Examples:
1_50_2;10gives a slider between 1 and 50 in steps of 2, starting at position 10hideGridhides the grid lines on the sliderhideStartsets no starting position (participant must move the slider)hideValuehides the numeric display of the selected valuehideMinMaxhides the min and max values at the ends of the sliderremoveFillremoves the colour fill that highlights the slider up to the selected point
Mouse clicks (clicks)
Section titled “Mouse clicks (clicks)”Allow participants to respond by clicking directly on stimuli or the screen. There are three click modes, all requiring responseOptions to be defined.
Column: responseType
Value: clicks
Record pixel location
Section titled “Record pixel location”Record the exact pixel coordinates where a participant clicked on an image.
Column: responseOptions
Value: pixel
- Records the location of the mouse on the clicked image
- Works for trials with one or multiple images
Custom origin point
Section titled “Custom origin point”By default, the (x=0, y=0) origin is the top-left corner of the clickable stimulus. You can change this by adding an origin option:
responseOptions value | Origin point |
|---|---|
pixel, origin:topLeft | Top-left corner (default) |
pixel, origin:topRight | Top-right corner |
pixel, origin:bottomLeft | Bottom-left corner |
pixel, origin:bottomRight | Bottom-right corner |
pixel, origin:center | Centre of the image |
Clickable response grid
Section titled “Clickable response grid”Overlay an invisible grid on top of images and record which cell was clicked.
Column: responseOptions
Value: grid(rows x columns) (e.g. grid(3x4))
grid(3x4)creates a grid of 3 rows and 4 columns on top of each image displayed on screen- Records the image and cell that the participant clicked
Minimum and maximum number of clicks
Section titled “Minimum and maximum number of clicks”Specify how many times a participant must click before advancing.
Column: responseOptions
Value: min:number;max:number (e.g. min:2;max:4)
min:2;max:4requires a minimum of 2 clicks and a maximum of 4 clicks to advance- Participants cannot advance until the minimum number of clicks is reached
- A button to advance appears only after the minimum is reached
- When the maximum is reached, the experiment advances automatically to the next trial (if no buttons are defined), or displays the defined buttons
Assign labels (label)
Section titled “Assign labels (label)”Allow participants to assign labels to images by drag and drop.
Column: responseType
Value: label
Use responseOptions to define the available labels:
Column: responseOptions
Value: label names separated by semicolons (e.g. label1; label2; label3)
Record voice (mic)
Section titled “Record voice (mic)”Record voice responses from participants via their microphone.
Column: responseType
Value: mic
By default, mic works as a voice key: any voice input advances the experiment to the next trial, and nothing is saved. Use responseOptions to keep the audio.
Column: responseOptions
| Value | Meaning |
|---|---|
(empty or na) | Voice key only. Speech onset advances the trial, nothing is saved. |
save | Same as save:1000. Saves 1 second of audio from voice onset. |
save:MS | Saves audio from voice onset until onset + MS milliseconds, then the trial advances. |
save:all | Records everything from the start of the trial until a button or key press, or until the responseWindow deadline ends the trial. |
save:no | Explicit way of saying “do not save” (identical to leaving responseOptions empty). |
start:trial | Modifier for save and save:MS: recording begins at the start of the trial instead of at voice onset. |
preVoice:MS | Modifier for save and save:MS: keep MS milliseconds of audio from just before the detected voice onset, so soft speech beginnings are not cut off. Default 0 (recording starts exactly at the detected onset). Example: preVoice:200. |
noHide | For unsaved voice key trials only: the stimulus does not disappear when the voice response is given. Trials that save audio always stay fully visible, so this token is not needed there. |
hideRec | Hides the recording indicator (the pulsating dot, mic icon, and countdown). |
Combine multiple options with ;, for example responseOptions = save:500;noHide or responseOptions = save:2000;start:trial.
Examples
responseType = mic, responseOptions = na (voice key, nothing saved)responseType = mic, responseOptions = save (onset to onset + 1s)responseType = mic, responseOptions = save:2000 (onset to onset + 2s)responseType = mic, responseOptions = save:2000;start:trial (trial start to onset + 2s)responseType = mic, responseOptions = save:all (everything, until a press or the deadline)Combining voice with buttons and keyboard
Section titled “Combining voice with buttons and keyboard”Buttons and keys defined on a mic trial always stay active alongside the microphone.
- With
saveorsave:MS, the voice response and the press race each other. Whichever happens first ends the trial. - With
save:all, voice never ends the trial by itself. Only a button press, a key press, or theresponseWindowdeadline does. - A press is always safe. It finalises and saves any recording that is in progress, so audio is never lost. With
save:all(orstart:trial), a press before any speech still saves everything captured from the trial start. With plainsave/save:MS, recording only begins at voice onset, so a press before any speech ends the trial with no audio file (the results columns showna).
Mic responses in the results file
Section titled “Mic responses in the results file”Mic trials that save audio add columns to the results file (audioFile, recOnset, voiceOnset, recDuration, voiceDuration, and recDropped when audio was lost); they are documented in Results Reference: Trial Columns. The usual response and RT columns reflect whichever event ended the trial: the voice response, a button or key press, or a timeout.
Audio files are named after their trial row (repeats of the same row are suffixed row5_2.wav, row5_3.wav, so nothing is overwritten), and each participant’s recordings can be downloaded as a zip from the Audio column of the Raw Data table.
How microphone input is detected and timed
Section titled “How microphone input is detected and timed”- Testable requests microphone permission at the device’s native sample rate (typically 44.1 kHz or 48 kHz)
- At the start of each session the participant reads a short passage aloud for 13 seconds, which calibrates an individual detection threshold. A live indicator (too quiet / good / too loud) shows the current level while reading. Calibration succeeds only when at least 3 seconds of actual speech were detected, the speech clearly stands out from the background noise, and the microphone is not distorting; each failure shows a specific message (increase the volume, move somewhere quieter, or lower the volume)
- During spoken-response trials, incoming audio chunks are analysed in real time. Speech onset is declared when amplitude crosses the calibrated threshold
- Voice onset latency is computed as
tOnsetminustEnableusing the browser’s high-resolution monotonic clock, and reported in themicOnsetcolumn - The microphone is armed and disarmed by
responseWindowlike any other response modality. Amin:minimum window also applies to voice, so an onset during the minimum window is held and completes the trial when the minimum ends, keeping the original onset time as its reaction time
Sort stimuli (sort)
Section titled “Sort stimuli (sort)”Allow participants to sort visual stimuli by dragging them into an order.
Column: responseType
Value: sort
Use responseOptions to specify which stimuli are sortable by their indices:
Column: responseOptions
- Range syntax:
1:3makes the first three images sortable - Individual indices:
1;2;3makes images 1, 2, and 3 sortable
Drag to target zones (drag)
Section titled “Drag to target zones (drag)”Allow participants to freely drag and drop all stimuli on screen.
Column: responseType
Value: drag
- Usually combined with a background image defined in the
backgroundcolumn, so participants drag movable images over a static canvas - In the results file, drag responses are in the format StimNo_HorizontalxVertical (pixel offset from centre)
Examples:
1_359x3means the 1st stimulus was moved 359 px right and 3 px down from centre2_-290x-4means the 2nd stimulus was moved 290 px left and 4 px up from centre
Scoring sort-type responses
Section titled “Scoring sort-type responses”When using responseType = sort, you can use the key column to automatically score responses. Define the correct order of stimuli names separated by ;.
Scoring uses position distance, the sum of how far each stimulus is from its correct position. 0 is a perfect score.
Example:
stimList = image1; image2; image3key = image3; image2; image1- If participant sorts:
image3; image2; image1→ correct = 0 (all in correct positions) - If participant sorts:
image3; image1; image2→ correct = 2 (image1 and image2 are each 1 position away)
responsePos: button and response position
Section titled “responsePos: button and response position”Use responsePos to control where buttons appear on screen:
bottom(default)topleftright- Custom pixel position using
x,ycoordinates
Defining correct responses
Section titled “Defining correct responses”The key column defines the correct answer for accuracy scoring.
- For button responses: the correct
keyis the number of the button (e.g.2) rather than the button label - For responding by clicking stimuli: the correct
keyis the position of the stimulus on screen (e.g.2) or the name of the stimulus column (e.g.stim2)
Multiple correct answers: separate with a semicolon:
key = f; FAlternative correct responses (OR logic): use | to define responses where any one is scored as correct:
key = 1 | 2 | 3This means either 1 or 2 or 3 is correct in this trial.
RT-based correct responses: score based on reaction time range rather than the response itself:
key = RT200_300:The response is scored correct if it was given between 200 and 300 milliseconds.
Showing participants their performance
Section titled “Showing participants their performance”To display the response, reaction time, or accuracy back to participants after a trial (including %response%-style variables and image feedback), see the Feedback page.
Enforcing response formats
Section titled “Enforcing response formats”Testable allows you to control how participants type in their responses by using HTML5 input attributes via the responseOptions column. This works with responseType = box in test trials.
How response constraints work
Section titled “How response constraints work”Each rule is written as property:value. Combine multiple rules with semicolons:
responseOptions = type:number;min:10;max:99Available properties
Section titled “Available properties”| Property | Effect |
|---|---|
type | Input type (number, date, color, email, etc.). Some types change the input widget (e.g. type:date shows a calendar picker) |
step | Allowed intervals between numbers (e.g. step:5 allows 5, 10, 15…) |
min | Minimum numeric value |
max | Maximum numeric value |
maxlength | Maximum number of characters |
placeholder | Greyed-out example text inside the response box |
pattern | Regular expression to enforce specific text formats |
Combinations are allowed. For example: pattern:[a-z]+;maxlength:10 accepts any lowercase text up to 10 characters.
Advanced input rules with pattern
Section titled “Advanced input rules with pattern”The pattern property uses regular expressions (regex) to enforce specific response formats:
| Rule | Pattern |
|---|---|
| Text only (letters) | pattern: [A-Za-z]+ |
| Four-digit number | pattern: \d{4} |
| Date (YYYY-MM-DD) | pattern: \d{4}-\d{2}-\d{2} |
| Alphanumeric code (ABC123) | pattern: [A-Za-z]{3}\d{3} |
| Restrict to specific words | pattern: (France|Germany|Italy|Spain) |
| Numeric range with sum | min:10;max:99;sum:30 |
Next steps
Section titled “Next steps”- Timing Parameters: control when responses are enabled and disabled
- Feedback: show participants their performance after each trial
- Survey Response Types: the question types available on form trials
- Forms and Surveys: form row anatomy, pages, and layout