If I have a form factory with 3 tables, how would I define the fields I
wanted shown for each?

This is the code for my controller. I have tried to set it in several spots
but all of them throw an error.

def register_patient():
    mark_not_empty(db.patient)
    mark_not_empty(db.emergencycontacts)
    mark_not_empty(db.dependents)
    form=SQLFORM.factory(db.patient, db.emergencycontacts, db.dependents,
formstyle = 'table3cols')
    fs0=form[0][:28]     # the first two name rows
    fs1=form[0][28:40]   # the wine data rows (all but the last)
    fs2=form[0][40:45]     # submit row (last)
    fs3=form[0][-1]     # submit row (last)

    form.vars.medical_record_number = 'KND' + str(date.today().year) +
'0000' + str(random.randrange(1, 9999999+1))

    form[0]=TABLE(
    FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"),
    FIELDSET(TAG.legend("Emergency Contact
Info"),TABLE(fs1),_id="register1"),
    FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"),
    TABLE(fs3))
    if form.process().accepted:
        id = db.patient.insert(**db.patient._filter_fields(form.vars))
        form.vars.patient=id
        id =
db.emergencycontacts.insert(**db.emergencycontacts._filter_fields(form.vars))
        response.flash='Thanks for filling the form'
        id = db.dependents.insert(**db.dependents._filter_fields(form.vars))
        form.vars.dependents=id
        # and get a list of all persons
        redirect(URL('manage_patients'))

    style = STYLE(""".not_empty {color:#d00;}""")

    return dict(form=DIV(style,form))


Thanks.

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to