*How to make so that the "client" database "address" took 'Id' database
"client". And attached to her **This example is taken from the chapter of a
book *One form for multiple tables
<http://web2py.com/books/default/chapter/29/07/forms-and-validators#One-form-for-multiple-tables>
db.define_table('client',
Field('name'))
db.define_table('address',
Field('client','reference client',
writable=False,readable=False),
Field('street'),Field('city'))
def register():
form=SQLFORM.factory(db.client,db.address)
if form.process().accepted:
id = db.client.insert(**db.client._filter_fields(form.vars))
form.vars.client=id
id = db.address.insert(**db.address._filter_fields(form.vars))
response.flash='Thanks for filling the form'
return dict(form=form)
--
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.