I'm having an issue where "value" is empty inside my custom widget. I have a field in my database that uses a custom dropdown widget:
Field('color_scheme', 'string', requires=IS_IN_SET(color_schemes.COLOR_SCHEME_NAMES), widget=color_choice_widget), I create a form using form=SQLFORM(...) and then I set the default value of the color_scheme with: form.vars.color_scheme = DEFAULT_COLOR_SCHEME In my custom widget, I want to read the current value so that I can apply certain styling to the selected value in the dropdown. But value=None inside my widget. Any idea what's going on? The custom dropdown widget is something like this: def color_choice_widget(field, value): """ Widget for the color scheme dropdown menu """ print value # Why does this print "None"? return \ DIV( # This DL is what the user sees TAG['dl']( <more stuff here>, _class="dropdown", _id="color_dropdown", ), # This hidden INPUT is what actually gets submitted, and has value set by javascript INPUT(_name=field.name, _class=field.type, _id="%s_%s" % (field._tablename, field.name), _value=value, requires=field.requires) ) Thanks in advance for any advice on what I'm missing Toby -- 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.