If you want to create/edit survey using one page you have to use JavaScript (I don't see another non-horrible way). If you want only web2py/python implementation you have to organize your application to edit one entity per page/request, i.e. you can do something as follows: /surveys - returns grid of surveys with references to /surveys/<survey> (per row) that returns grid of sections + references to /surveys/<survey>/<section> that returns grid of questions + references to /surveys/<survey>/<section>/<question> that returns grid (or form with `select multiple` ) of answers with scores
On Saturday, October 12, 2019 at 7:54:05 PM UTC+3, NGNZONE wrote: > > Situation Description > > First things first, I am not a very experience web2py developer but I have > learned the basics of the framework, so please pardon me if my questions > are not so constructive. I started working on a survey application which > will enable users to create multiple choice questions. A question will have > a number of choices, and when the user selects a particular choice, a > corresponding score will be added to a sub total. That is if the survey is > about Fruits for instance, if a user selects oranges, 5 will be added to > the sub total for that section, if another user selects Mangoes, 10 will be > added to the sub total and so on. The attached screenshot survey_layout > will better explain what I am talking about. It has three columns, the > first column is the question, the second, the corresponding choices and the > third column the score linked to each choice. [Survey layout][1] There are > six sections in the survey, and each section has a sub_total which is > generated from the score value of each choice the user chooses on each of > the questions. Finally the sub_totals will be added up to give a grand > total for the entire survey and it can then be interpreted. What I have > done so far is as seen on the follow screenshots > > > > Questions: > > 1.How do I create my models in such a way that the user can dynamically > create questions for the survey for each section on the page and when the > user takes the survey, each choice the user selects, will correspond to a > score value which can be tracked and summed up to give the section totals? > > 2.How will my form be defined to output all the questions for each section > one after the other on the screen? I have tried using SQLFORMS but don't > know exactly how to achieve this. > > 1. Thinking of using pagination to separate the sections so the page > will not be too long. any better option? > > References: I have watched the web2py survey by MASSIMO DI PIERRO where I > learn how to do what I have done so far. > > Thanks in advance > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/b7569962-55f3-4c90-bfcd-2db1afea88eb%40googlegroups.com.