Strange problem with checkbox. I have a component that puts up a
checkbox:

INPUT(_type='checkbox',value=row.mytable.apply,
    _name='apply-%d'%id,
    _id='apply-%d'%id,
#    _onclick="ajax('%(url)s',['apply-%(id)s'],':eval');return
false;"%dict(url=URL(f='apply_data',args=id),id=id)
    _onclick="web2py_ajax_page('POST','%(url)s/%
(id)d',null,'debug');return
false;"%dict(url=URL(f='apply_data'),id=id)
    )

As you can see from the above, I've tried getting this to work 2
different ways: one with the regular ajax post and the other with the
equivalent web2py_ajax_page post.

The controller looks something like this:

def apply():
  db.mytable[int(request.args(0))]=dict(apply=True) if request.vars
else dict(apply=False)
  db.commit()
  return ''


Two things I'm noticing. One is, when I click multiple times on the
checkbox, I'm not seeing a checkmark appear and disappear in the
checkbox. This is definitely not right.

The other thing I'm seeing is that when the checkbox state goes from
"off" to "on" as I click it, I expect to see request.vars go from
blank to a non-null value. This is not happening.

What's also strange is that this used to work before I turned the view
of this into a component. Any ideas what is going on and how to fix it?

Reply via email to