You'll have to create a custom form in some fashion, setting the input names to distinguish the specific tables for fields with the same name.
Anthony On Monday, April 21, 2014 2:34:30 PM UTC-4, Spokes wrote: > Thanks for the clarification, Anthony. Can you recommend a good way to > achieve the functionality I mentioned, or does such a form, along with > processing, inserts, etc., have to be manually crafted? > > On Monday, April 21, 2014 1:20:16 PM UTC-5, Anthony wrote: >> >> No, the documentation mentions this as a limitation of using >> SQLFORM.factory with multiple tables. >> >> On Monday, April 21, 2014 1:56:44 PM UTC-4, Spokes wrote: >>> >>> I'm using SQLFORM.factory() to generate a form from multiple tables, >>> some of which have fields that have the same names as fields in other >>> tables. In the form that's generated, the first instance of the field with >>> the common name appears, but any subsequent instances of the field with >>> that name are absent. A basic version of the code is something like this: >>> >>> Model: >>> >>> db.define_table('table1', ... Field('address', type='text',length=512, >>> Label = T('address')), ...) >>> db.define_table('table2', ...) >>> db.define_table('table3', ... Field('address', type='text',length=512, >>> Label = T('address')), ...) >>> >>> Controller: >>> >>> form = SQLFORM.factory(db.table1, db.table2, db.table3) >>> >>> In the generated form, only one instance of 'address' would appear. Is >>> there a way to have SQLFORM.factory() create a form that contains all >>> instances of fields with shared names, and to have it distinguish them so >>> as to facilitate inputting the values of the form.vars into the appropriate >>> tables (I'd imagine an insert with _filter_fields should still work, >>> but asking just in case)? Thank you. >>> >> -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.