A form button.
Within a form, you can nest Button components. Note that you don't have to do
this to let the form work (a simple <input type="submit".. suffices), but
if you want to have different kinds of submit behavior it might be a good
idea to use Buttons.
The model property is used to set the "value" attribute. It will
thus be the label of the button that shows up for end users. If you want the
attribute to keep it's markup attribute value, don't provide a model, or let
it return an empty string.
When you add a Wicket Button to a form, and that button is clicked, by
default the button's onSubmit method is called first, and after that the
form's onSubmit method is called. If you want to change this (e.g. you don't
want to call the form's onSubmit method, or you want it called before the
button's onSubmit method), you can override Form.delegateSubmit.
One other option you should know of is the 'defaultFormProcessing' property
of Button components. When you set this to false (default is true), all
validation and formupdating is bypassed and the onSubmit method of that
button is called directly, and the onSubmit method of the parent form is not
called. A common use for this is to create a cancel button.
author: Jonathan Locke author: Eelco Hillenius |