Hi,

I could be looking in the wring place, but i don't see an example on
referencing ALL the fields of another table without having to name
them - I would like the combination of tables to be  more dynamic, so
that "sub-tables (forms) could be created on the fly depending on user
input... something like this (taken from the 'Tip of the day' thread):

def newBuildRequest():    # formerly register()
    form=SQLFORM.factory(db.rm_request,db.buildRequest)
    if form.accepts(request.vars):
        id =
db.rm_request.insert(**db.rm_request._filter_fields(form.vars))
        form.vars.rm_request=id
        id = db.insert(**db.buildRequest._filter_fields(form.vars))
        response.flash='Thanks for filling the form'
    return dict(form=form)


db.define_table('rm_request',     # main form - mandatory to al forms
        Field('fied1'),
        Field('fied2'),
        Field('fied3'))

db.define_table('customBuildRequest',      # sub-table/form - data
comes from custom request (request not available in list)
        Field('fied1'),
        Field('fied2', requires=db(db, table1.ALLFIELDS))

or

        Field('fied2', requires=db(db, table1.fields()))

or something...


Thanks,
Mart :)

Reply via email to