[web2py] Re: build a row base questionnaire

2010-08-24 Thread dlin
Thanks. But I found this method have a problem: when I show the score after submit, the form's random data is changed. And the form become empty, so the user can not see why he is wrong. On 8月23日, 上午10時31分, mdipierro wrote: > We need to clarify the goal. The goal is not to propose questions to >

[web2py] Re: build a row base questionnaire

2010-08-23 Thread Russell
A much more sophisticated solution Massimo! I completely missed the orderby='' functionality. Going back to the original question, the point here is that when you have a 'normalised' table of question/answers, you need to decouple from SQLFORM (with SQLFORM.factory) and handle the db interactions

[web2py] Re: build a row base questionnaire

2010-08-22 Thread mdipierro
We need to clarify the goal. The goal is not to propose questions to the user. the goal is to check if he answers correctly. Should each correct answer be recorded for each user? should incorrect answers be recorded? Should the list of proposed questions be recored? Should a score be computed? What

[web2py] Re: build a row base questionnaire

2010-08-22 Thread Russell
In my experience, it is a bit awkward to do this using SQLFORM. You could try something like this: db.define_table('q_and_a', Field('question'), Field('answer')) rows = db(db.q_and_a.id>0).select() import random random.seed() asked = random.sample(rows, 3)) form=SQLFORM.factory( Fi

[web2py] Re: build a row base questionnaire

2010-08-19 Thread dlin
Tks, Bruno. I seems haven't describe the 'row base' questionaire. That is: I've already a table like: Question Answer Q1... A1 Q2... A2 Q3... A3 ... Q13... A1 Then, I'll random choose three(or by customized) questions to ask. Question Answer Q3.