To Massimo, I think this should be in the book after this http://web2py.com/books/default/chapter/29/07#One-form-for-multiple-tables
Thanks! 2013/1/29 Angelo Compagnucci <angelo.compagnu...@gmail.com> > Hi Annet! > > This is freaking awesome and it worked like a charm! > > I found a way to add automatically variables to form.vars, hope this helps! > > record = db(...).select().first() > > for table in [db.table1, db.table2]: > for field in table.fields: > form.vars[field] = record[table][field] > > > 2013/1/29 Annet <anneve...@googlemail.com> > >> I solved a similar problem the following way: >> >> >> # retrieve records >> node=db(db.node.id==id).select(db.node.ALL).first() >> address=db(db.address.nodeID==id).select(db.address.ALL).first() >> telecom=db(db.telecom.nodeID==id).select(db.telecom.ALL).first() >> # build form >> form=SQLFORM.factory(db.node,db.address,db.telecom) >> # prepopulate the form >> form.vars.field1=node.field1 >> ... >> form.vars.field5=address.field5 >> ... >> form.vars.field9=telecom.field9 >> # process form >> if form.process().accepted: >> node.update_record(**db.node._filter_fields(form.vars) >> address.update_record(**db.address._filter_fields(form.vars) >> telecom.update_record(**db.telecom._filter_fields(form.vars) >> >> >> I hope this helps you solve the problem. >> >> Kind regards, >> >> Annet >> >> -- >> >> --- >> 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. >> >> >> > > > > -- > Profile: http://it.linkedin.com/in/compagnucciangelo > -- Profile: http://it.linkedin.com/in/compagnucciangelo -- --- 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.