for referenced tables you can use this:
http://web2pyslices.com/main/slices/take_slice/102

Bruno Rocha
http://about.me/rochacbruno/bio


2011/1/21 Lennon <[email protected]>

> 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