Sure thanks in advance that is my DB so for example if I select company I
want it to redirect to company and if I select a certrain country lets say
germany or so I want it to redirect to the german page of company would
that be possible ?
db.define_table('partner',
Field('name'),
Field('address'),
Field('country',requires=IS_IN_SET(countries)),
Field('postalcode'),
Field('entity_type',requires=IS_IN_SET(['Company','Person'])),
Field('partner_manager', 'reference auth_user', requires = IS_IN_DB(db,
'auth_user.id','%(last_name)s')),
Field('email'),
Field('web'))
that is my controller:
def partner():
form = SQLFORM(db.partner, _name='form_partner')
if form.process().accepted:
session.flash = 'Partner added !'
redirect(URL('partnerlist'))
else:
session.flash = 'Please try again !'
return dict(form=form)
Jim S schrieb am Donnerstag, 25. August 2022 um 22:30:56 UTC+7:
> Can you share the code you have so far?
>
> I'd probably do something like:
>
> form = SQLFORM.factory(...your form definition here...)
>
> if form.process().accepted:
> if form.vars.field_1 == 'some test case you want to redirect on':
> redirect(URL('my_redirect_url', vars=dict(my vars to pass to the
> redirect))
> elif form.vars.field_2 == 'another test case you want to redirect on':
> redirect(URL('my other redirect url')
>
> -Jim
>
> On Thursday, August 25, 2022 at 12:48:05 AM UTC-5 [email protected]
> wrote:
>
>> I have a form with a few selections but I want to redirect it to a other
>> page depends on the selection does someone know how to do that ?
>
>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/d5e81bc3-d1ba-48a7-9d52-04603294d8ebn%40googlegroups.com.