I am creating an extra element in form as per guide
http://web2py.com/book/default/chapter/07#Adding-extra-form-elements-to-SQLFORM

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_title">Preferences:</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?

Reply via email to