If by current you mean 1.98.2 then yes, I saw that code and I wondered
how it is happening, not sure yet.

Sample code to reproduce:

#controller
def buttons():
  return dict()

def button_test():

  def mouseup(s='true'):
    return "jQuery('#button_test input[type=\'checkbox
\']').attr('checked',%s);return false;"%s
    # note: it does not matter if there is 'return false' at the end
or not

  NBSP = XML(' ')
  ee = [CAT(INPUT(_name = 'opt%s'%x, _value = 'opt%s'%x, _type =
'checkbox'),
            NBSP,
            SPAN('opt%s'%x),
            BR())
        for x in range(3)]
  ee.insert(0, CAT(
    BUTTON('Select all', _ONMOUSEUP = mouseup()), NBSP,
    BUTTON('Deselect all', _ONMOUSEUP = mouseup('false')), BR() ))
  ee.append(INPUT(_type = 'submit', _value = T('Submit')))
  return FORM(*ee)

#view
{{extend 'layout.html'}}
{{=LOAD('comps', 'button_test.load', ajax=True,
target='button_test')}}

When one clicks the 'Select all' button visually nothing happens but
the checkboxes are first marked as checked but then a POST
button_test.load is issued which effectively clears them out again by
replacing the form with a clean one. Somehow the mouse event is
causing the reload.

Reply via email to