Alex, I think you want to add input in the generated form and this is possible with jQuery but it leed to a list of values instead of value in your form.vars.var...
This thread contains many informations about that : https://groups.google.com/d/msg/web2py/UK8NZ1VMlNk/lRqxKgS10ScJ But in your case you may consider web2py component... Your child field could be in the component form and the parent field in the main form that is submit only once by the component form... I have no code sample for you... But I think you can figured out by yourself. In the book there is differents piece of doc that could help about the component and multiple form per page and a example where you can have only one submit button with jQuery and submit 2 or more form... What I propose is a kind of a hack since there is no easy way to add input put in web2py (or dynamic form). Richard On Mon, Mar 18, 2013 at 1:28 PM, Mark <[email protected]> wrote: > Alex, > > Sorry, I don't have any related examples and don't know how to do it. I > guess you may need a jquery dialog and a while loop, which continue to run > until the dialog return "No". > > Mark > > On Monday, March 18, 2013 11:01:27 AM UTC-4, Alex Glaros wrote: > >> It worked. Thanks Mark. >> >> Can you provide a link to any examples where user has the ability to >> enter a variable number of children? I mean once they type in the parent >> and one child, something like a prompt is displayed asking "do you want to >> add another child record?". This would let them enter as many children as >> they want, while having entered the parent data only once. >> >> thanks, >> >> Alex >> >> >> >> On Monday, March 18, 2013 6:47:45 AM UTC-7, Mark wrote: >>> >>> try form.vars.sharedServiceID=**sharedServiceID >>> >>> On Sunday, March 17, 2013 3:13:58 AM UTC-4, Alex Glaros wrote: >>>> >>>> I'm trying to automatically populate child FK field "sharedServiceID" >>>> using the controller below, but the field gets filled with "none" >>>> >>>> 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('**SharedServicePartnerIntersecti**on', >>>> Field('*sharedServiceID*', 'reference SharedService', >>>> writable=False,readable=False)**, >>>> >>>> ##------------------------ >>>> db.**SharedServicePartnerIntersecti**on.sharedServiceID.requires = >>>> IS_IN_DB(db, db.SharedService.id, >>>> '%(shortSharedServiceTitle)s',**zero=T('choose >>>> one')) >>>> db.**SharedServicePartnerIntersecti**on['_plural'] = 'Partner List' >>>> >>>> CONTROLLER >>>> >>>> def add_partner(): >>>> form=SQLFORM.factory(db.**SharedService,db.** >>>> SharedServicePartnerIntersecti**on) >>>> if form.process().accepted: >>>> *sharedServiceID* = db.SharedService.insert(**db.** >>>> SharedService._filter_fields(**form.vars)) >>>> form.vars.SharedService=*sharedServiceID* >>>> db.**SharedServicePartnerIntersecti**on.insert(**db.** >>>> SharedServicePartnerIntersecti**on._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.** >>>> SharedServicePartnerIntersecti**on) >>>> if form.process().accepted: >>>> sharedServiceID = db.SharedService.insert(**db.** >>>> SharedService._filter_fields(**form.vars)) >>>> form.vars.SharedService=**sharedServiceID >>>> *sharedServiceID = *db.**SharedServicePartnerIntersecti** >>>> on.insert(**db.**SharedServicePartnerIntersecti** >>>> on._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 [email protected]. > 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

