It is because of this
value=True
If you remove it will not be always set to true.
On Apr 4, 1:20 am, Rohan yourbuddyro...@gmail.com wrote:
I am creating an extra element in form as per
guidehttp://web2py.com/book/default/chapter/07#Adding-extra-form-elements-...
here is the code
controller
settings_form = SQLFORM(db.auth_user, record, fields = ['first_name',
'email'], labels = {'first_name' : 'Full Name', 'email': 'Email
Address'}, submit_button = 'Submit', showid=False)
custom_checkbox = TR(LABEL(), TD(INPUT(_name='agree',value=True,
_type='checkbox'), LABEL('Some setting')))
settings_form[0].insert(-1, custom_checkbox)
view
h2 class=form_titlePreferences:/h2
{{=LOAD('default', 'settings', ajax=True, target='TargetDiv')}}
on submitting this form from page, the checkbox value toggle itself.
If it's on, after submitting, it will be set to off and if it's on
then on submitting, it will be reset to on.
I also tried this code in simple bare minimum welcome application to
check if any javascript inserted from my end is causing this issue but
faced same issue.
Any pointers?