model:

db = DAL('sqlite://storage.sqlite')

db.define_table('thing', Field('category'), Field('year', 'integer'))

db.thing.category.requires = IS_IN_SET(['a', 'b', 'c'])
db.thing.year.requires = IS_IN_SET([2000, 2001, 2002])

controller:

def index():
    form = SQLFORM.factory(db.thing)
    if form.accepts(request.vars, session):
        things = db((db.thing.category == form.vars.category) &
                    (db.thing.year == form.vars.year)).select()
    else:
        things = []
    return dict(things=things, form=form)


On Jun 30, 10:09 am, Giuseppe Luca Scrofani <[email protected]>
wrote:
> After two days of attempts I still can't figure it out. What I want is
> a set of dropdown selection, every one with some options and a submit
> button. When options are selected and submit pressed it start a search
> in a db table and return the list of all occurrence meeting all
> selected criteria... Something like this:
>
> Dropdowns
> - Category (choose from: a, b, c)
> - Year (choose from: 2000, 2001, 2002)
>
> Submit button (label: search)
>
> db model logically is like this:
> things
>         category
>         year
>
> If someone would be so nice to help me, Im very frustrated. What I
> really want now is someone showing me an example or pointing me to a
> simple tutorial, I'm sick of this problem.....
> Thanks in advance, even some psycological support woul be good :D

Reply via email to