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:

  • A property may be set to some value; this uses the selected and tag parameters.
  • A listener may be notified.
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.

When invoking listeners invoked within a For loop this listener should be used.

This parameter should not be used in the majority of cases as the listener is notified before all form data has been captured on the server. Only use this when you know you are going to redirect or do some other cancelling sort of action that isn't likely to alter form state. Use action as your preferred listener method parameter.

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.

If you are going to notify a listener, this is probably the parameter you want to bind to.

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).

submitType String - [submit,cancel,refresh] yes submit Controls the type of submission that this component invokes. Using javascript this parameter will cause the invocation of the component to be recognized as a cancel/refresh/normal form submission depending on the value given. If you have a cancel="listener" or refresh="listener" parameter set on your Form they will be invoked accordingly.
updateComponents String[],Collection no In an asynchronous request, specifies which components should have their content rendered back to the client. These are expected to be unique component ids.

See: ResponseBuilder

json boolean no false Causes the request to be asynchronous and the response to be captured/rendered via the JSONResponseBuilder renderer.
async boolean no false Causes the request to be asynchronous and the response to be captured/rendered via the DojoAjaxResponseBuilder renderer.

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.