I am extending my first question to solve a more challenging problem. Considering the below db.py and default.py I'm trying to have 2 cascading drop-downs in a custom form where the second depends to what is selected in the first (see rem'ed text below in "db.define_table('C',").
db.py
db.define_table('A',
Field('A1', 'string', required=True),
Field('A2', 'string', required=True),
format='%(A1)s)
db.define_table('B',
Field('B1', db.A),
Field('B2', 'string', required=True),
format='%(B2)s)
db.define_table('C',
*# select drop down of all records in A.C1*
Field('C1', db.A),
*# cascading drop down selecting all records of B.B2 WHERE B.B1=C.C1*
Field('C2', db.B),
Field('C3', 'string', required=True))
default.py
def C():
rows = db(db.C).select(orderby=~db.C.C1|~db.C.C2).render()
return locals()
Any help out there on this?
Would be also nice to have the drop-down content of C.C1 and C.C2 ordered by the reder()
text of C1 and C2.