Thanks Massimo, that worked perfectly.

I wasn't aware of the [('id1', 'label1'), ('id2', 'label2')] syntax
for IS_IN_SET.

Thanks for the quick response!

On 20 ene, 22:30, Massimo Di Pierro <[email protected]>
wrote:
> I am still not sure but I will give it a try:
>
> options=[(2,'Fitnesscentrum'),(3,'Fysiofitnesscentrum'),(4,'Personal
> Trainer'),(5,'Dietist(e)'),(6,'Voedingsconsulent(e)'),
> (7,'Yogaschool')]
>
> def index():
>     form=SQLFORM.factory(Field('bedrijf',requires=IS_IN_SET(options)),
>                          Field('city'))
>     if form.accepts(request):
>         response.flash='%s in %s' (dict(options)
> [int(form.vars.bedrijf)],form.vars.city)
>     return dict(form=form)
>
> form=SQLFORM.factory(Field('bedrijf',requires=IS_IN_SET([2,3,4,5,6,7],label
> s=['Fitnesscentrum','Fysiofitnesscentrum','Personal
> Trainer','Dietist(e)','Voedingsconsulent(e)','Yogaschool'],zero=None)))
>
> On Jan 20, 3:15 pm, Álvaro J. Iradier <[email protected]> wrote:
>
>
>
>
>
>
>
> > I found thread where someone asked exactly the same question I'm
> > trying to solve:
>
> >http://groups.google.com/group/web2py/browse_thread/thread/ba58ec07a2...
>
> > but the question wasn't answered, quoting from the last post:
>
> > ---------------------------
> > ...
>
> > In a controller I defined a form:
>
> > form=SQLFORM.factory(Field('bedrijf',requires=IS_IN_SET([2,3,4,5,6,7],label 
> > s=['Fitnesscentrum','Fysiofitnesscentrum','Personal
> > Trainer','Dietist(e)','Voedingsconsulent(e)','Yogaschool'],zero=None)))
>
> > ...
>
> > Massimo,
>
> > I am not sure you did understand my question correctly.
>
> > When in the form the user selects 'Fitnesscentre' in the drop box, the
> > function that selects all the Fitnesscentres takes 2 as its argument.
> > I would like the flash in the view to display something like:
>
> > "Fitnesscentres in Amsterdam"
>
> > request.vars.city gives me Amsterdam, what I am looking for is
> > something similar for Fitnesscentres, however, request.vars.bedrijf
> > gives me 2.
> > ---------------------------
>
> > Is it possible?
>
> > Thanks very much,

Reply via email to