whoa, what I meant was passing a variable to a function, not an action.... 
(action being a function that generates a page).
the onvalidation call works only for functions, not actions.
in that case, why don't you simply use redirect() from one action to 
another ?

On Sunday, October 6, 2013 5:46:40 PM UTC+2, Kees de Blois wrote:
>
> Thanks Niphlod for putting me on the right track.
>
> How do I load the session.thema variable in the target function (in the 
> place of request.args(0))
>
>
>
> @auth.requires_login()
> def tekstperthema():
>     response.flash = "Tekstregister items per thema view!"
>     form = SQLFORM.factory(Field('thema',requires=IS_IN_DB(db,db.thema.id, 
> '%(name)s')))
>     if form.process(onvalidation=tekstregisteritemsperthema).accepted:
>            response.flash = 'form accepted'
>            session.thema = form.vars.thema
>     elif form.errors:
>            response.flash = 'form has errors'
>     return dict(form=form)    
>
> @auth.requires_login()
> def tekstregisteritemsperthema():
>     response.flash = "Tekstregister items per thema view!"
>     items = db((db.tekstregister.boek==db.boek.id
> )&(db.tekstregister.publicatie==db.publicatie.id
> )&(db.tekstregister.soort==db.soort.id)&(db.tekstregister.jaar==db.jaar.id
> )&(db.tekstregister.thema==db.thema.id
> )&(db.tekstregister.thema==request.args(0))).select(orderby=db.tekstregister.boek|db.tekstregister.hoofdstuk)
>     return dict(items=items)    
>
>
> On Sunday, October 6, 2013 2:05:09 PM UTC+2, Niphlod wrote:
>>
>> I'd use onvalidation
>>
>> http://web2py.com/books/default/chapter/29/07/forms-and-validators#onvalidation
>>
>>
>> On Sunday, October 6, 2013 1:05:44 PM UTC+2, Kees de Blois wrote:
>>>
>>> How do I send the variable of the drop down list to another function?
>>>
>>> def tekstperthema():
>>>     response.flash = "Tekstregister items per thema view!"
>>>     form = SQLFORM.factory(Field('thema',requires=IS_IN_DB(db,
>>> db.thema.id, '%(name)s')))
>>>     if form.process().accepted:
>>>            response.flash = 'form accepted'
>>>            session.thema = form.vars.thema
>>>     elif form.errors:
>>>            response.flash = 'form has errors'
>>>     return dict(form=form)     
>>>
>>> United Bible Societies Association, a company limited by guarantee. 
>>> Registered in England and Wales No 2264875. Registered Charity No 800058 
>>> Registered Office: Stonehill Green, Westlea, Swindon, Wiltshire, SN5 
>>> 7PJ, England.
>>>
>>
> United Bible Societies Association, a company limited by guarantee. 
> Registered in England and Wales No 2264875. Registered Charity No 800058 
> Registered Office: Stonehill Green, Westlea, Swindon, Wiltshire, SN5 7PJ, 
> England.
>

-- 
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/groups/opt_out.

Reply via email to