I have two reasons for not wanting to use SQLFORM factory.  First, I
can't figure out or find how to use SQLFORM factory as an update/
delete form when combining multiple table (although I'd love to see
how if it can be done).  Second, I will be wanting to do some really
complicated forms in the future and would like to understand how to
combine SQLforms.

With the insert form code listed below, I've been able to combine the
two forms on one page.  They both render (with two submit buttons) and
the form validation works for both of them regardless of which submit
button I hit (which made me think I had successfully combined them).

But when the form accepts the data, it only does an insert on the
original form and doesn't work on the appended form.

When I run in debug mode I see that FORM.vars correctly has captured
all of the values for both forms.  But FORM.table and FORM.fields both
only have the values for the first SQLFORM.

Thanks for any help you can give me.

def test_add_user():

    form = SQLFORM(db['user'])
    form.insert(len(form),SQLFORM(db['address']))

    #submit data
    if form.accepts(request.vars):

        #check whether the form had errors
        if form.errors:
            response.flash = 'Form has errors'
            return dict(form=form)
        else:

            session.flash = "User Added"
            redirect(URL('admin', 'test_add_user'))

    #return the view
    return dict(form=form)

Reply via email to