Browse source code
Chris @ oTree
Recipes for common tasks in oTree
'Are you sure?' popup based on the user's input
Back button for multiple instructions pages
Basic single-player game (BMI calculator)
Chat with experimenter, using Papercups
Comprehension test. If the user fails too many times, they exit.
Configurable players per group. See here: https://otree.readthedocs.io/en/latest/treatments.html#...
Count button clicks (hidden input)
Using CSS to style timer and chat box.
Of course oTree has a readymade chat widget described here: https://otree.readthedocs.io/en/late...
Detect and block mobile browsers
Dropout detection (if user does not submit page in time)
Preserve same groups as a previous app that used group_by_arrival time.
group by arrival time, but in each round assign to a new partner.
Reads groups from a CSV file. Inside this app, you will find a groups6.csv, which defines the gro...
Longitudinal study (2-part study taking place across days/weeks) Another way to do longitudinal ...
Minimum time on a page
How to translate an app to multiple languages (e.g. English and German). There are 2 ways to def...
Timeout spanning multiple pages
Question that lets you select multiple options (multi-select, multiple choice / multiple answer)
Select a random round for payment
All you need is a participant field called 'progress' then keep adding 1 to it.
Read quiz questions from a CSV. (Also randomizes order) It would be much simpler to implement thi...
Menu with an 'other' option that lets you type in a value manually
Quiz with explanation. Re-display the previous page's form as read-only, with answers/explanation.
Radio buttons in various layouts, looping over radio choices
Table where each row has a left/right choice, like the strategy method. This app enforces a singl...
Random number of rounds for multiplayer (random stopping rule)
For each participant, randomize the order of tasks A, B, and C. Task B has 2 pages, which are alw...
Ranking your top N choices from a list of options.
"Widget to rank/reorder items". See http://sortablejs.github.io/Sortable/ for more examples.
Sliders and checkboxes that don't get wiped out on form reload.
An image that changes when you move a slider. If your image is a some kind of chart, it's better ...
Slider with live updating label
Reading treatment parameters from a CSV spreadsheet
Wait only for specific people
group_by_arrival_time timeout (continue with solo task)
Timeout on a WaitPage (exit the experiment)
Note: To open an *.otreezip file, enter:
otree unzip BLAH.otreezip