My controller has a componentized form with an added Cancel button
like this (this is an excerpt, so sorry for any typos):
def update( ):
myform = SQLFORM.factory(
Field('text_in','text',requires=IS_NOT_EMPTY()),
buttons=[INPUT(_type='submit',_value=T('Update'))],
_id='myform',
formstyle='divs'
)
form.element('input[type=submit]').parent.append(
TAG.BUTTON(T('Cancel')),_onclick='ajax("%s",[],":eval");' % URL(
c='my_controller', f='cancel_update')
)
if myform.process(formanem='myform').accepted:
...do stuff...
return dict(myform=myform)
The form submits
properly when the Update button is pressed. However, when the Cancel
button is pressed, not only does
the "cancel_update" callback get called, the form also gets submitted
erroneously. The question is, why does the "update" action get called and
its form get submitted at all when the Cancel button is pressed?
--