oTree Forum >

Asking a whole lot of questions (many forms)

#1 by mitnec

Hello all,
I'd like to collect data on what books people are reading. To do this, I'd like to present ~75 popular books, split across three pages and ask them two questions about each: 1) How many times have you read it? 2) About how many years ago did you last read it? Each page would have a table with the title, the author, q1, and q2. I'm reading the titles and authors in with read_csv.

I can make a function to generate a single field, like q76 = make_field(76), but that means I end up with 76 fields on my players and each page has ~25 form fields, double it since there are two questions.

Is there a smarter way to do this, presenting things in a table on the html page? I can imagine doing it with ExtraModel, but that also seems kind of clunky. Having 76 (or 152) form fields isn't a problem in the end, I guess?


#2 by Chris_oTree

See the app questions_from_csv_complex here: https://www.otreehub.com/projects/?featured=1

This app only presents 1 question at a time, which is the easier option, but with some JavaScript & HTML you can present a whole table at once.

Write a reply

Set forum username