El Thu, 6 Jun 2013 16:07:41 -0700 (PDT)
Jose <jjac...@gmail.com> escribió:
> Hello
> 
> I have the following
> 
> def boolean_widget(field, value):
>     return SELECT(
>             OPTION('Si', _value=True),
>             OPTION('No', _value=False),
>             _name=field.name,
>             _id='%s_%s' % (field._tablename, field.name),
>             )
> 
> 
> tb_algo = db.define_table('algo',
>     Field('name'),
>     Field('test', 'boolean'),
> )
> tb_algo.test.widget = boolean_widget
> 
> 
> 
> the form is displayed well, but always saves True
> 
> What this doing wrong?
> 
> Jose
> 

the boolean types have a default widget, which is a checkbox, when is
checked is True, and when is not is False, becouse it is empty... when
you Choose Si or No, you send a value so you get True becouse it is not
empty to be False.

I thinks that's the problem.

-- 

--- 
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/groups/opt_out.


Reply via email to