i have the model
db.define_table( 'foobar',
Field('open', 'boolean', requires = IS_IN_SET([(True, 'open'),
(False, 'closed')], zero = None), default = True,
widget=SQLFORM.widgets.radio.widget),
)
and the controller
def edit():
return crud.update(db.foobar, request.args(0), deletable = False)
but it does not work since open is always True because "False" gets
interpreted as string with content and not as boolean
so i have to fix it like this
def edit():
def on_accept(form):
open = False if request.vars.open == 'False' else True
if form.vars.id and db.foobar[form.vars.id]:
db.foobar[form.vars.id].update_record(open = open)
return crud.update(db.foobar, onaccept = on_accept, request.args(0),
deletable = False)
are there alternatives to creating radioboxes for True False
selections? Of course custom validator, but is there something already
built in?