Hi Michael,

I've tried to include the information in the session and it worked
perfectly !

Thank you very much

On Aug 16, 2:02 pm, Michael Pedersen <[email protected]> wrote:
> I might be oversimplifying, but is there any reason you couldn't place an
> <input type="hidden" name="question_num" value="${question_num}"/> in  your
> template?
>
> That would allow you to put the question number into the template, at least.
>
> An alternate )and possibly better) solution would be to add the last
> question number asked to the user's session, and then use the session to
> determine what to display/save.
>
> I might be oversimplifying, but this seems like a viable course for you.
>
>
>
>
>
>
>
>
>
> On Tue, Aug 16, 2011 at 1:40 PM, Adlq <[email protected]> wrote:
> > Hello,
>
> > In my project, I need the users to be able to fill surveys. Right now,
> > I have added 2 methods to my root.py controller file: fill_survey and
> > new_answer because I have decided to go question by question (the user
> > answers the first question, clicks the 'submit' button, then the page
> > displays the second question, and so forth...) and not by displaying
> > all the questions at once for I'm still unsure how to handle that.
>
> > So the first method (fill_survey) corresponds to the page that
> > displays the question. It is linked to a template, which displays the
> > question as a <form> tag whose 'action' attribute is set to the method
> > 'new_answer'. The latter basically writes the answer to the database
> > and then redirects the user to a new 'fill_survey' page displaying the
> > next question. I hope I've made myself clear.
>
> > Now here's my problem. The 'new_answer' method needs to "know" which
> > question the user has just answered in order to "tell" the
> > 'fill_survey' method to display the next question. That information is
> > included in the previous 'fill_survey' method (that called our
> > 'new_answer' method) and in the template file, but there is no way I
> > can send it to the 'new_answer' method from the template or from the
> > 'fill_survey'.
>
> > The redirect instruction enables me to pass parameters to the
> > specified method, for example
>
> > redirect('fill_survey', question=...,....)
>
> > But I can't find a way to do the same thing with the 'action'
> > attribute of <form>.
>
> > What do you think ?
>
> > Thank you,
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "TurboGears" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> >http://groups.google.com/group/turbogears?hl=en.
>
> --
> Michael J. Pedersen
> My IM IDs: Jabber/[email protected], AIM/pedermj022171
>           Yahoo/pedermj2002, MSN/[email protected]
> My LinkedIn Profile:http://www.linkedin.com/in/michaeljpedersen
> Twitter: pedersentg

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to