Why you can't specify in IS_IN_DB and pass a subset of you table and use
where clause to subset your DB like this :

db(db.plant.plantNumber!=2)

??

Look in the book how to pass a set instead of db to IS_IN_DB class...

Richard

On Mon, Nov 14, 2011 at 12:16 PM, Jim Steil <j...@qlf.com> wrote:

>  Hi
>
> Using SQLFORM.factory and trying to build a dropdown box based off a table
> but limiting the options in the dropdown.  Here is what I have:
>
>     plantsNotForUser = db(db.plant.plantNumber==2)
>
>     form = SQLFORM.factory(
>         Field('plantId', db.plant, label='Plant',
>               requires=IS_IN_DB(db, 'plant.id', '%(plantNumber)s -
> %(name)s',
>                                 zero='...choose one...',
>                                 _and=IS_NOT_IN_DB(plantsNotForUser, '
> plant.id')),
>               default=plantId))
>
> However, when I display the form, plant number 2 is included in the list.
> I don't want to show that one.
>
> Am I misunderstanding what the _and arg does?
>
>     -Jim
>
>

Reply via email to