You can add a Cancel Button to forms in Seaside by using the WACancelButtonTag. The code snippet to do so is:
renderContentOn: html html form: [ html textInput.... html cancelButton callback: ; with: 'Don't change anything'.]
Seaside does register the action callback for a cancel button with a very high priority (-5, to be exact), which makes sure the cancelButton’s action callback is executed before all the value callbacks in your form get executed.
But be careful: Seaside by default only ensures the callback of the cancel button is executed before all the others, but it does not prevent the others to be executed!
This means that if you add a cancel button to a form, its action callback will be performed first and all the value callbacks will be performed afterwards.
The end result will be that your model objects get updated with the contents of your form controls, just as if you had pressed a normal submit button.
You can however, make the cancel button do exactly what you want it to do by implemtntig the callback in a way that keeps seaside from handle all callbacks with lower priorities. You simply have to send
self handleAnswer: false
in your callback, so that Seaside ignores all other callbacks.
This means you can use a Cancel Button to perform a few operations like rolling back a database Transaction and make sure the changes in the form are nut propagated to the model objects by this.
I was a bit confused by the fact that if you do not provide a callback at all, Seaside also does not add a default callback to the cancel button which stops callback processing.
To summarize: If you want a cancel button on your form, make sure you really cancel by setting handleAnswer to false. Otherwise changes in the form will be propagated to your model like when using a submitButton