Jakarta > Tapestry
Jakarta
 

Submit

Provides an HTML form submission element, <input type="submit">. The Submit component must be enclosed by a Form component. A Submit component is used when a single form has multiple form submission buttons, and the application needs to know which one is the trigger for the form submission.

The application can use two techniques to determine which Submit component (if any) caused the form to be submitted:

It is even possible to combine the two, in which case the property is set first, then the listener is notified. The listener may be notified immediately (i.e., in the middle of processing the form submission) if provided via the 'listener' parameter, but if it is provided via the 'action' parameter, the listener will be notified later, just before the form's listener (if any) is invoked.

See also: org.apache.tapestry.form.Submit, Form, ImageSubmit, LinkSubmit

Parameters

Name Type Direction Required Default Description
label (deprecated) String in no   The label put on the button (this becomes the HTML value attribute). Alternately, the value attribute may simply be specified as an informal parameter.
disabled boolean in no false If set to true, the button will be disabled (will not respond to the mouse); the browser should provide a "greyed out" appearance.
selected Object out no   This parameter is bound to a property that is updated when the submit button is clicked by the user. The property is updated to match the tag parameter.
tag Object in no   Tag used with the selected parameter to indicate which Submit button on a form was clicked.
listener IActionListener in no   An optional listener (typically specified as the name of a listener method), notified when the Submit is triggered.
action IActionListener in no   A listener that is notified if this component is triggered just before the form's listener, after all components enclosed by the Form have had a chance to update their properties.
parameters Object in no   Parameter(s) gathered at the time the button is triggered, supplied as listener parameters in the IRequestCycle available to the listener.

If the parameter is a Collection, it will be converted to an Object array (to match the IRequestCycle getListenerParameters() signature).

Allows listeners provided by the 'action' parameter to access any rewinded state not conveniently placed using tag/selected (e.g. when there are multiple objects to select as might happen with a nested For).

Body: removed

Informal parameters: allowed

Reserved parameters: name, type

Example

<form jwcid="form@Form" listener="listener:doSubmit">
<table>
  <tr>
    <th>User name:</th>
    <td><input jwcid="userName@TextField" value="ognl:userName" size="12"/></td>
  </tr>
  <tr>
    <th>Password:</th>
    <td><input jwcid="password@TextField" value="ognl:password" hidden="true" size="12"/></td>
  </tr>
  <tr>
    <td colspan="2">
      <input type="submit" value="Login"/>
      <input type="submit" jwcid="help@Submit" action="listener:doHelp" value="Help"/>
    </td>
  </tr>
</table>
</form>

Here, the page class will have two listener methods: doHelp() and doSubmit(). doHelp() will be invoked if the user clicks the Help button, then doSubmit() will be invoked either way.