I loop through a form object to change all the classes:
form = crud.create(db.messages, next = URL('index'))
parts = ['title', 'body', 'subject'] # corresponding fields
classes = 'form-control col-md-12' # my classes
for p in parts:
form.custom.widget[p]['_class'] = '%s %s' % (classes, form.custom.widget[p]['_type'])
This is working - but: subject
is an autocomplete widget:
db.messages.subject.widget = SQLFORM.widgets.autocomplete(...)
and here _class
is not changed (or altered afterwards again?)
How can this be fixed? Thanks!