Produces a HTML4 button element like this: <button type="...">Create</button>. Its design and implementation has been more than inspired by the Tapestry standard components Submit and Button, which uses HTML input elements.

The original motivation for using the HTML4 button element (and creating the Html4Button component) was that this HTML element allows for the text/label of the button to be the body of the button element tag, which in turn allows for using HTML as the button name (e.g. like underlining accesskey).

This component also makes the HTML4 button element work across different browsers. When using several HTML4 buttons in a form, most browsers would submit the value of the button pressed. However Internet Explorer submits all buttons which makes it difficult to figure out which was activated. Furthermore it sends whatever was between the <button ..> and </button> instead of sending the value which isn't what the Html4 specification states.

See the specification of button and how a form shoud be submitted. Finally see the specification of a button in IE. More on this issue can be found on this maillist.


In order to make this component work cross platform (see problem in description above), a hidden field is used along with a small javascript function to detect what button has caused the submission of the form. On the server side the tapestry component checks this hidden field instead of the button and then follows the same flow as the tapestry Submit component. The script is placed on the onclick attribute of the button element. If the onclick handler is defined already, that functionality is appended.


Name Type Required Default Description
label java.lang.String no Used for "value" property of the final html element (the submitted value if button is pressed)
type java.lang.String yes One of the allowed values for HTML4 button.type property, which at the time of writing this is "button", "submit" or "reset" (HTML4.01).
disabled boolean no false Sets the disabled="disabled" property on the button element if true.
onclickEventHandler java.lang.String no Value of this property is appended to the "onclick" attribute generated by this component. Html4Button makes "onclick" a reserved parameter because it needs to put an onclick event on the button (see above description of problem in IE). Often, you will need your own onclick event on a button, which is what this attribute is for.
selected java.lang.Object no Binds the value of the "tag" parameter to this outgoing parameter at submit time iff the submit was a result of a click on this button.
listener IActionListener no If set, this action listener is called if this button is clicked.

Further info

  • Body: Rendered
  • Informal parameters: Allowed
  • Reserved parameters: name, onclick


Presuming you have defined bayeux library in you application under the library name "bayeux":
<button jwcid="@bayeux:Html4Button" type="submit" listener="listener:add" accesskey="a" label="Add"><u>A</u>dd</button>