Indeed, and of course you can create the METALS list from a table and then cache it (as long as it doesn't change so much). It works very efficiently.
On Monday, 17 June 2013 19:14:29 UTC+1, André Kablu wrote: > > Hi, > > I don`t know why you are referencing another table, but if this is only > for populate that field and you know that those values will not change or > increase, you may consider using lists: > > METALS = ( > (1, 'silver'), > (2, 'gold'), > (3, 'iron'), > (4, 'zinc') > ) > db.table.field1.requires = IS_IN_SET(METALS, zero=None) > > this should solve your problem and create a select for you, also you will > not need to confirm selection. > > Em segunda-feira, 17 de junho de 2013 13h48min05s UTC-3, webpypy escreveu: >> >> Thank you, everybody. >> >> let me describe what i am trying to do. >> >> a table has field1 , field2 >> >> field1 is referenced in reftable1 >> field2 is referenced in reftable2 >> >> reftable2 has a field (reftable1_id) that is referenced in reftable1. >> >> field1 is entered through dropdown list by >> db.table.field1.requires = IS_IN_DB(db(db.reftable1.id>0),'reftable1.id' >> , '%(name)s') >> >> >> My question is about entering field2, the dropdown list needs to be >> according to the value entered in field1. >> db.table.field2.requires = IS_IN_DB(db(db.reftable2.reftable1_id == >> request.vars.field1),'reftable2.id','%(name)s') >> >> is not working. >> >> >> why? >> or how to debug? >> >> Regards, >> >> ashraf >> >> -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.