I need to present a list of edit forms, one for each tag in db.tags. I've
written the controller below, but it doesn't work because (I think) the
variable "thisform" is identical for each form. I think the problem is that
I need to assign a unique variable name to each form (i.e., each time
through the "for" loop). But since you can't use operators in a variable
name, I'm not sure if this is possible. Is there a simple solution?
tags = db(db.tags).select()
taglist = []
for tag in tags:
thisform = SQLFORM(db.tags, record=tag.id, deletable = True,
showid=False, fields=['tag'], labels = {'tag':''}, submit_button = 'update',
delete_label = 'delete ', record_id = None, formstyle = 'table2cols',
separator = '', _name=tag.tag)
if thisform.accepts(request.vars, formname=tag.tag):
response.flash = 'updated'
else:
response.flash = 'form has errors'
taglist.extend(thisform)