I have three tables (country, state, and town) each one has a field called
name:
db.define_table('country'
Field('name', 'string'),
... more fields ...
)
db.define_table('state'
Field('name', 'string'),
Field('country_id', 'reference country'),
... more fields ...
)
db.define_table('town'
Field('name', 'string'),
Field('state_id', 'reference state'),
... more fields ...
)
In the controller I join these tables with SQLFORM.factory(db.country,
db.state, db.town) in order to generate a form:
form = SQLFORM.factory(db.country, db.state, db.town)
I am using form.custom in my view. However I don't know how to
differentiate between these fields (country.name, state.name, and
town.name), when I call form.custom.widget.name I get the first one defined
in SQLFORM.factory().
It is not in my hand to change the name of the fieldnames in the model (the
solution I thought). It is not possible. I need to use form.custom because
I am splitting my form in tabs.
Any suggestion?
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.