Is is set expects a python list or dict. If you want to a dropdown
from a list of records:

def get_services()
    form = SQLFORM.factory(SQLField('name', label='Select a service',
       requires=IS_IN_DB(db,'service.name',orderby=db.service.name))
    return dict(form=form)

On Aug 24, 10:04 am, David <digitalcry...@gmail.com> wrote:
> I've been having a heck of a time trying to figure out how to make a
> simple drop down list from a table in the database.
>
> What I would like to do is have a drop down list populated by the
> table information and when a person selects that item from the drop
> down I want it to go to a page that pulls up all of those types of
> items.
>
> I've seen reference to IS_IN_SET() and IS_IN_DB() but it doesn't make
> much sense to me since there are a lack of examples.
>
> This is what I have so far on it.
>
> def get_services()
>     services = db(db.services.name>0).select(orderby=db.services.name)
>     form = SQLFORM.factory(SQLField('name', label='Select a
> service',requires=IS_IN_SET(services)))
>     return dict(form=form)
>
> default/get_services.html
>
> {{=form}
>
> This does create a drop down but it has a bunch of extra information
> about query and lambda which I don't need and only displays about half
> of the names in the table.  I just need the name and the ID like a
> normal dropdown list with auto submit.
>
> Has anyone a reference to something like this?
>
> Thanks,
> David

Reply via email to