Problem solved and, most important, concept learnt.
Thank you a lot for your help Denes.

Arlindo

Em sábado, 24 de outubro de 2015 22:58:24 UTC-2, DenesL escreveu:
>
>
> Your view(s) can only see the variables that you return from the 
> controller, in your case mainly 1: form.
>
> So your result view is not getting any variables from its controller.
> You have two options:
> 1) retrieve the values from the session directly in the view (you have 
> been saving them)
> 2) retrieve the values from the session in the controller and return the 
> variables needed in a dictionary
>
> Option 1 might look like this in the view:
>
> {{if (session.emp == 'EIA' and session.UC == 'CZA'....}}
>
> or initialize the vars without changing the ifs:
>
> {{emp = session.emp
> UC = session.UC
> ...
> }}
> {{if (emp == 'EIA' and UC == 'CZA' ...
>
>
> Option 2 is similar but in the controller:
>
> return {'emp': session.emp, 'UC': session.UC, ...}
>
> Denes.
>
>
> On Saturday, October 24, 2015 at 8:32:00 PM UTC-4, Arlindo Gomes Filho 
> wrote:
>
>
> Hi everybody,
>
> I’m beginner, trying to develop a code in which the user is asked to 
> answer three questions (presented in two sequential forms) and, based on 
> the combination of those answers the code (in the view “result”)  is 
> supposed to present the user the one procedure among four available that 
> best apply to the situation.
>
>
> The first form (LIC_ZON) is correctly redirecting to the second one, which 
> is also correctly redirecting to the view “result”. My problem is that it 
> seems my code in the view “result” is not processing the answers chosen by 
> the user and that are passed by the sessions.   No matter the options 
> chosen by the user, only one and the same procedure is always presented in 
> the view (procedure four). I can't get what I'm missing.
>
>  
>
> Thanks for any help.
>
>
> Complete code in: https://github.com/argofix/Bungo
>
>
> My contoller:
>
>
>
> def LIC_ZON(): form = SQLFORM.factory( Field('emp', label='Type of 
> license:', requires=IS_IN_SET(['EIA', 'SEIA', 'NALIC'])), Field('UC', 
> label='Type of zone:', requires=IS_IN_SET(['CZA', 'SZA', 'NAZA'])) ) if 
> form.process().accepted: session.flash = 'Option succesfully inserted!' 
> session.emp = form.vars.emp session.UC = form.vars.UC emp = 
> request.vars.emp UC = request.vars.UC if form.vars.UC == 'CZA': 
> redirect(URL('UCCZA')) if form.vars.UC == 'SZA': if form.vars.emp == 'EIA'
> : redirect(URL('UCSZA3')) if form.vars.emp == 'SEIA': redirect(URL('UCSZA2
> ')) if form.vars.emp == 'NALIC': redirect(URL('UCNALIC')) if form.vars.UC 
> == 'NAZA': redirect(URL('UCNAZA')) return dict(form=form) def UCCZA(): 
> form = SQLFORM.factory( Field('uccza', label='Where is the activity 
> located?', requires=IS_IN_SET(['IUC', 'IZA', 'FZA'])) ) if 
> form.process().accepted: response.flash = 'Option succesfully inserted!' 
> session.uccza = form.vars.uccza uccza = request.vars.uccza redirect(URL('
> result')) return dict(form=form) def UCSZA3(): form = SQLFORM.factory( 
> Field('ucsza3', label='Where is the activity located?', requires=
> IS_IN_SET(['IUC', 'ZPD3', 'FZPD3'])) ) if form.process().accepted: 
> response.flash = 'Option succesfully inserted!' session.ucsza3 = 
> form.vars.ucsza3 ucsza3 = request.vars.ucsza3 redirect(URL('result')) 
> return dict(form=form) def UCSZA2(): form = SQLFORM.factory( Field('ucsza2
> ', label='Where is the activity located?', requires=IS_IN_SET(['IUC', '
> ZPD2', 'FZPD2']))
>
> ...

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to