Do not do this: gluon.sqlhtml.FormWidget._attributes = _attributes
It would change the widget for all applications called concurrently. Instead do db.table.field.widget = lambda field: FormWidget(field,_attributes = _attributes) On Nov 8, 8:18 am, "mr.freeze" <[email protected]> wrote: > If you want to append a class to every widget, you can replace the > _attributes static method of sqlhtml.FormWidget. Try this in your > model: > ... > @staticmethod > def _attributes(field, widget_attributes, **attributes): > attr = dict( > _id = '%s_%s' % (field._tablename, field.name), > _class = field.type, > _name = field.name, > requires = field.requires, > ) > attr.update(widget_attributes) > attr.update(attributes) > attr.update(_class=attr['_class'] + ' myclass') #<-----NEW > return attr > > import gluon.sqlhtml > gluon.sqlhtml.FormWidget._attributes = _attributes > > Or were you wanting to actually do it at the helper level? > > On Nov 8, 1:58 am, Thadeus Burgess <[email protected]> wrote: > > > But I don't want the labels to have this class, just the actual form > > elements > > > -Thadeus > > > On Sun, Nov 8, 2009 at 1:56 AM, Thadeus Burgess > > <[email protected]>wrote: > > > > What would be the best way to automatically pass a certain class to every > > > web2py form helper? (INPUT, TEXTAREA, etc..) > > > > -Thadeus > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

