[web2py] Re: Is there something like an "optional requires"

2011-10-21 Thread Massimo Di Pierro
You can file a request for improvement. This cannot be changed without hitting the db twice: to validate the field to update the options. Right now we ask that is done explicitly. On Oct 21, 12:02 pm, Calycé wrote: > That's exactly what I'm experiencing. Do I need to file a bug ? > > On Oct 2

[web2py] Re: Is there something like an "optional requires"

2011-10-21 Thread Calycé
That's exactly what I'm experiencing. Do I need to file a bug ? On Oct 21, 4:11 pm, Anthony wrote: > I *think* if you submit a form and immediately reload a new form (as part of > the same action), the new form's dropdown is populated (via the IS_IN_DB > validator) before the db insert of the sub

[web2py] Re: Is there something like an "optional requires"

2011-10-21 Thread Anthony
I *think* if you submit a form and immediately reload a new form (as part of the same action), the new form's dropdown is populated (via the IS_IN_DB validator) before the db insert of the submitted form, so the new form doesn't have the most up-to-date set of values. If that's the case, it sho

[web2py] Re: Is there something like an "optional requires"

2011-10-21 Thread Calycé
Thanks a lot to both of you the IS_EMPTY_OR() was indeed what I was needing (note to self: reread the book...) Could anyone of you tell me when the the combo is populated ? I'm just asking because now, when I enter a record using the appadmin interface, the new record is not appearing in the combo

[web2py] Re: Is there something like an "optional requires"

2011-10-21 Thread DenesL
Hi Calycé, note that: store.category.parent_category.requires = 0 or IS_IN_DB(db, db.category.id, '%(name)s') is equivalent to: store.category.parent_category.requires = IS_IN_DB(db, db.category.id, '%(name)s') since 0 evaluates to False. I believe that what you want is: store.category.parent_cat

[web2py] Re: Is there something like an "optional requires"

2011-10-21 Thread Anthony
IS_EMPTY_OR(IS_IN_DB(...)) See http://web2py.com/book/default/chapter/07#Validators. Anthony On Friday, October 21, 2011 3:35:06 AM UTC-4, Calycé wrote: > > Hi all, > > I have created a table with a self reference as described below: > db.define_table('category', > Field('parent_category'