Hi,

i was reading about conditional fields (
http://web2py.com/books/default/chapter/29/07/forms-and-validators#Conditional-fields
)

and i have a question.

is it possible to do it as a table definition?

bellow are my table definition:

Adverts = db.define_table('adverts',
                           Field('owner_id', 'integer'),
                           Field('type_id', 'integer'),
                           Field('description', 'text'),
                           Field('image', 'upload'),
                           Field('city_id', 'integer'),
                           Field('zone_id', 'integer'),
                         )

Adverts_Type = db.define_table('adverts_type',
                           Field('label', 'string'),
                           Field('description', 'text'),
                         )

Cities = db.define_table('cities',
                           Field('label', 'string'),
                         )

Zones = db.define_table('zones',
                           Field('city_id', 'integer'),
                           Field('label', 'string'),
                         )

Adverts.type_id.requires = IS_IN_DB(db(Adverts_Type), 'adverts_type.id',
'%(label)s')
Zones.city_id.requires = IS_IN_DB(db(Cities), 'cities.id', '%(label)s')


i need to create a form to fill the Adverts with zones per selected city.


Rgds

Diego

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to