Field('id_client', db.client,
requires=IS_IN_DB(db(auth.accessible_query('read', db.client)),
'client.id','%(name)s'))


On Mar 10, 9:45 am, vihang <vihan...@gmail.com> wrote:
> say
>
> db.define('client',
>      Field('name'))
>
> db.define('address'
>      Field('id_client', db.client, requires=IS_IN_DB(db, 'client.id',
> '%(name)s'))
>
> when I use SQLFORM for address table, the input id_client populates
> with all names in the client table. I would like it to populate with
> only those names where are authorized. The output would be equivalent
> to db(auth.accessible_query('read', db.client)).select(db.client.id,
> db.client.name)
>
> Does it make sense?
>
> On Mar 10, 7:37 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> >  I believe you do not need a new validator you can just use IS_IN_DB
> > but can you give us more details?
>
> > On Mar 10, 9:18 am, vihang <vihan...@gmail.com> wrote:
>
> > > Hello,
>
> > > I am trying to write a validator which I can use to populate select
> > > box using result from auth.accessible_query. I believe IS_IN_DB
> > > validator would be a good start. Could some give me a hint if there is
> > > an easy tweak I can apply, or will it be dirty hack?
>
> > > Thanks
> > > vihang

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to