Yes I am using smartgrid elsewhere, very nice. I did do the 3 forms but used the factory to do it. Works nicely so far.
On Tue, Jun 18, 2013 at 1:24 PM, villas <villa...@gmail.com> wrote: > I don't believe you can use SQLFORM in that way, you'll have to create > your own form - maybe try SQLFORM.factory. Better still, try > SQLFORM.smartgrid which could allow you a very flexible way to manage all > three tables. > > > > On Tuesday, 18 June 2013 16:40:40 UTC+1, t...@caregointl.com wrote: >> >> I have one page where I want to show 3 forms. I have a main table with 2 >> tables that are related to it. >> >> So in my models file I have: >> >> db.define_table( >> 'dependents', >> Field('dep_id',db.patient), >> Field('first_name'), >> Field('middle_name'), >> Field('last_name'), >> Field('relationship', 'text')) >> >> db.define_table( >> 'emergencycontacts', >> Field('ec_id',db.patient), >> Field('first_name'), >> Field('middle_name'), >> Field('last_name'), >> Field('address1'), >> Field('address2'), >> Field('city'), >> Field('state'), >> Field('zipcode'), >> Field('country'), >> Field('phone'), >> Field('relationship')) >> >> And db.patient is another table. >> >> So in my form I have: >> >> def register_patient(): >> form=SQLFORM.factory(db.**patient,db.emergencycontacts, >> db.dependents) >> if form.process().accepted: >> id = db.patient.insert(**db.**patient._filter_fields(form.** >> vars)) >> form.vars.patient=id >> id = db.emergencycontacts.insert(**** >> db.emergencycontacts._filter_**fields(form.vars)) >> response.flash='Thanks for filling the form' >> id = db.dependents.insert(**db.**dependents._filter_fields(** >> form.vars)) >> form.vars.dependents=id >> # and get a list of all persons >> records = SQLTABLE(db().select(db.**patient.ALL),headers='** >> fieldname:capitalize') >> >> return dict(form=form, records=records) >> >> So the form displays correctly but I was expecting that the other fields >> for dependents and emergencycontacts would be there for input as well but I >> only get the id fields showing up for input. >> >> Am I doing what I want to do incorrectly? >> >> Thanks, >> >> Tom >> > -- > > --- > 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. > > > -- --- 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.