Hi Nathan, thanks for the response. I checked the old threads (like
this one
http://groups.google.com/group/web2py/browse_thread/thread/35c5708111d173ae/7d12923e4643a3ed?lnk=gst&q=ajax+checkbox#7d12923e4643a3ed)
and see this is an old issue. In fact, I complained of this a long
time ago in a separate post. I'll try your fix and report back.

On Dec 4, 2:14 pm, "mr.freeze" <nat...@freezable.com> wrote:
> The var name should just be 'junk' since that is the name of the
> checkbox. Also, I don't think you should have a closing parenthesis
> after _id='no_table_junk'. Just a typo? Also, accessing it like
> request.vars['no_table_junk'] will throw an error. Why not just use
> request.vars.xxx and check for None? Also, it will not have a value of
> 'off' when unchecked, request.vars will just be empty. This works for
> me:
>
> def checktest():
>     div=DIV(_id='test')
>     inp = INPUT(_type='checkbox',
>                 _name='junk',
>                 _id='no_table_junk',
>                 _onclick="ajax('process_checkbox',
> ['no_table_junk'],':eval');")
>     return dict(div=div,inp=inp)
>
> def process_checkbox():
>   checkbox_results=request.vars.junk
>   return """jQuery("#test").html("%s");""" % checkbox_results
>
> On Dec 4, 12:57 pm, weheh <richard_gor...@verizon.net> wrote:
>
> > I have a form with a dummy checkbox:
>
> > #view
> > INPUT(_type='checkbox',_name='junk',_id='no_table_junk'),
> >         _onclick="ajax('process_checkbox',
> > ['no_table_junk'],':eval');")
>
> > #controller
> > def process_checkbox():
> >   checkbox_results=request.vars['no_table_junk']
> >   return """jQuery("#test").html("%s");""" % checkbox_results
>
> > Regardless of whether the checkbox is checked or not, the onclick
> > event passes to the "process_checkbox" routine a
> > request.vars['no_table_junk'] equal to 'on'. I would have expected it
> > to toggle from "on" to "off" to "on" again as I keep toggling the
> > checkbox from checked to unchecked.
>
> > Anybody know what's wrong?
>
>

Reply via email to