I'm trying to automatically populate child FK field "sharedServiceID" using the controller below, but the field is displayed as unpopulated to the user.
I'd like the field to be either displayed to the user as populated with "sharedServiceID" from the parent table,or not appear to the user at all and be populated with sharedServiceID behind the scenes. When I look at the resulting data, sharedServiceID in the child file either is "none" if user leaves it blank, or whatever the user typed in. Do you see any flaw in the controller format below? Thanks, Alex Glaros PARENT TABLE db.define_table('SharedService', Field('shortSharedServiceTitle', 'string', label='Title')) ##------------------------ CHILD TABLE db.define_table('SharedServicePartnerIntersection', Field('*sharedServiceID*', 'reference SharedService')) ##------------------------ I tried commenting out the lines below, but sharedServiceID field still shows up. ------------- db.SharedServicePartnerIntersection.sharedServiceID.requires = IS_IN_DB(db, db.SharedService.id, '%(shortSharedServiceTitle)s',zero=T('choose one')) db.SharedServicePartnerIntersection.sharedServiceID.represent = lambda id,row: db.SharedService(id).shortSharedServiceTitle db.SharedServicePartnerIntersection['_plural'] = 'Partner List' CONTROLLER def add_partner(): form=SQLFORM.factory(db.SharedService,db.SharedServicePartnerIntersection) if form.process().accepted: *sharedServiceID* = db.SharedService.insert(**db.SharedService._filter_fields(form.vars)) form.vars.SharedService=*sharedServiceID* db.SharedServicePartnerIntersection.insert(**db.SharedServicePartnerIntersection._filter_fields(form.vars)) response.flash='Thanks for adding a shared service partner' return dict(form=form) also tried this def add_partner(): form=SQLFORM.factory(db.SharedService,db.SharedServicePartnerIntersection) if form.process().accepted: sharedServiceID = db.SharedService.insert(**db.SharedService._filter_fields(form.vars)) form.vars.SharedService=sharedServiceID *sharedServiceID = * db.SharedServicePartnerIntersection.insert(**db.SharedServicePartnerIntersection._filter_fields(form.vars)) response.flash='Thanks for adding a shared service partner' return dict(form=form) -- --- 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.