[web2py] Re: howto subset a select element

2012-08-14 Thread Anthony
IS_EMPTY_OR(IS_IN_DB(db, db.lecture_items.id, '%(title)s (%(id)s)')) Anthony On Tuesday, August 14, 2012 10:59:42 PM UTC-4, lucas wrote: > > ok, moving along, > > what if i want the option of allowing the user to leave: >... >Field('lecture_item_id', db.lecture_items, requires=IS_IN_DB(db

[web2py] Re: howto subset a select element

2012-08-14 Thread lucas
ok, moving along, what if i want the option of allowing the user to leave: ... Field('lecture_item_id', db.lecture_items, requires=IS_IN_DB(db, db.lecture_items.id, '%(title)s (%(id)s)')), ... blank. meaning, if the user choses it in the select element, fine, it should be in the refer

[web2py] Re: howto subset a select element

2012-08-14 Thread Anthony
You can't do that all at once when you respond to the initial request because it depends on user input, so you have to populate the second select via Ajax on the client side once the first selection is made. See here

[web2py] Re: howto subset a select element

2012-08-14 Thread lucas
ok, what if i have a nested type select field like: db.define_table('class_assignments', Field('class_id', db.classes, requires=IS_IN_DB(db, db.classes.id, '%(class_title)s (%(id)s)'), writable=False, readable=False), Field('lecture_id', db.lectures, requires=IS_IN_DB(db(db.lectures.user

[web2py] Re: howto subset a select element

2012-08-13 Thread Massimo Di Pierro
I was hoping last week. Not I am hoping next week. We have closed most of the tickets we think were important but there are a couple more to deal with. On Monday, 13 August 2012 09:00:48 UTC-5, Anthony wrote: > > p.s. hey, when is web2py v2.0 going to be stable and released full? > > > I thin

[web2py] Re: howto subset a select element

2012-08-13 Thread Anthony
> > p.s. hey, when is web2py v2.0 going to be stable and released full? I think very soon, not sure exactly when. > doesn't it have angularjs built into it also? > No, where did you hear that? Anthony --

[web2py] Re: howto subset a select element

2012-08-13 Thread lucas
oh my, that is so perfect, i love that. i learned a new word and i am going to use it everywhere. thanx anthony. p.s. hey, when is web2py v2.0 going to be stable and released full? doesn't it have angularjs built into it also? --

[web2py] Re: howto subset a select element

2012-08-13 Thread Anthony
The first argument to IS_IN_DB and IS_NOT_IN_DB can be a Set object rather than the entire db: IS_IN_DB(db(db.courses.teacher = auth.user_id), db.courses.id, '%(title)s (%(id)s)') See http://web2py.com/books/default/chapter/29/7#Database-validators. Anthony On Monday, August 13, 2012 8:21:44