I forgot to paste :
def register():
form=SQLFORM.factory(db.client, db.address, formstyle = 'divs') #,
table_name='dummy_name')
if form.accepts(request.vars):
id = db.client.insert(**db.client._filter_fields(form.vars))
form.vars.client=id
id = db.address.insert(**db.address._filter_fields(form.vars))
response.flash='Thanks for filling the form'
return dict(form=form)
What to do for what in red?
I think _filter_fields is the key of the problem...
I didn't have a look to it actually...
Richard
On Tue, Jan 18, 2011 at 7:00 PM, Richard Vézina <[email protected]
> wrote:
> Hello Massimo,
>
> I am trying to insert data in 2 tables from one form... I would like to be
> able to insert any number of rows or records in the subtable.
>
> I build this test app (see attach)... All the work I did is mostly in
> /default/register.html where there is jQuery script that allow adding new
> city input and delete new city input...
>
> I built it from scratch for Web2py inspired by :
> http://charlie.griefer.com/blog/index.cfm/2009/9/17/jQuery--Dynamically-Adding-Form-Elements
>
> What should I do in register to allow the function to insert all the filled
> city clone field??
>
> Next step will be adapted my script that it manage all the subform columns
> instead of only one.
>
> Thanks.
>
> Richard
>