On Friday, July 8, 2016 at 9:48:52 AM UTC-4, Alfonso Serra wrote: > > Just to post the right solution. > > filter_in didnt work out since im not saving the form when its posted, > just using the form to generate a query. > So the right solution would be something like: > > > form = SQLFORM(db.myfilters).process(dbio=False, keepvalues=True, > onvalidation=enable_bool_tri_state) > > #check if a field has a bool_radio widget > def enable_bool_tri_state(form): > for fld in form.fields: > field = form.table[fld] > if field.widget == bool_radio_widget and request.post_vars[fld] == > None: > form.vars[fld] = None > > It would be ideal if the bool tri state is declared in the field > definition somehow so its handled properly later on. Ill try a custom > validator or widget and get back with a better solution. >
Unfortunately, I think SQLFORM will always convert a boolean to True or False, regardless of the widget or validator used (the conversion happens after validation). If you want three values, you either need something like you've got above, or a different field type. 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.