On Sunday, September 7, 2014 9:22:06 PM UTC-4, Alex wrote: > > I didn't know of custom forms. Maybe it's something that wasn't available > when I started with my forms (using v2.4.6) or I just missed it. > It's been around forever.
Actually I'm doing a little bit more in my form function (e.g. setting > maxlength attribute depending of length value of field) but I guess this > could also be done with custom forms somehow. > That might be best handled via the widget argument when defining the field: Field('mystring', widget=lambda f, v: SQLFORM.widgets.string.widget(f, v, _maxlength=f.length)) You could also automate that via a function or create a custom widget: def mystring(f, v): return SQLFORM.widgets.string.widget(f, v, _maxlength=f.length) Field('mystring', widget=mystring) Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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/d/optout.