A normal button, created with <tc:button/>
, must be actively pressed,
to run the action. A default-button can be activated, even if not selected.
For example, the cursor is in an inputfield and the enter key is pressed.
A button can be made to a default button with the defaultCommand
attribute.
The default button is highlighted by another color.
To make the examples more clear, the ID of the last active button is displayed in the following outputfield.
After writing some text into the textfield, the user can press 'ENTER' to activate the submit-button.
The related default-button is searched in the current <tc:form/>
.
If there no default-button could found, the search is continued in the parent form and so on.
If no default-button found on this way, the button is search outside of a form.
In this example, the 'Submit A'-button is in a form together with a intputfield and outputfield. The 'Submit B'-button is outside a form.
Now, if the cursor is in 'Textfield A' and the enter key is pressed, the 'Submit A'-button is activated. Therefor only the 'Textfield A'-value will be submitted.
If the cursor is in 'Textfield B' and the enter key is pressed, the 'Submit B'-button is activated. This will submit the 'Textfield A'-value as well as the 'Textfield B'-value.