[web2py] Re: extra element in form toggles automatically

2011-04-25 Thread Rohan
Any updates?

as a workaround I am using  response.js and setting the correct value of 
checkbox from js.


[web2py] Re: extra element in form toggles automatically

2011-04-04 Thread Massimo Di Pierro
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?


[web2py] Re: extra element in form toggles automatically

2011-04-04 Thread Rohan
If not always setting it to true, it's toggling it. Once on then off then on 
and so on, 

I modified code and set value based on boolean variable but had same issue.

custom_checkbox = TR(LABEL(), TD(INPUT(_name='agree',value=session.dummy, 
_type='checkbox'), LABEL('Some setting'))) 
settings_form[0].insert(-1, custom_checkbox) 

on form accept

session.dummy =(not session.dummy)


[web2py] Re: extra element in form toggles automatically

2011-04-04 Thread Rohan
 instead of session.dummy =(not session.dummy) on above post,  i tried this 

on form.accepts 
session.dummy = form.vars. agree

still the checkbox toggles.