ImageSubmit

A component that generates a clickable image that will cause the enclosing form to submit. The <input type="image"> form element was originally designed for use as a way to select a pixel within an image that was presumable a map; it has been co-opted by web applications as a way to decorate a form submit button using a custom image instead of ordinary clickable buttons. This component is simply an enhanced version of the Submit component that will display an image instead of a text label.

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

Parameters

Name Type Direction Required Default Description
image IAsset in yes The normal image to display for the button.
name String in no Overrides the default mechanism for selecting the form element id; this allows the name attribute of the rendered <input> tag to be controlled, which is necessary is some browsers to control the tooltip help message for the control.
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.
disabledImage IAsset in no If specified, and if the component is disabled, then this image is used rather than the normal image parameter. This allows an alternate image to be used to indicate to the user that the option is not available.
point java.awt.Point out no Set to the coordinates of the clicked point within the image.
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 deferred listeners (defer = true) access to any rewind state not conveniently placed using tag/selected (e.g. when there are multiple objects to select as might happen with a nested Foreach).

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: type, src, border

Warning:

In Tapestry 3.0, the behavior of the ImageSubmit was undeferred , the equivalent of setting the defer parameter to false. The default for the defer parameter in 4.0 is true , which may in rare cases, cause problems when upgrading an applicaton from 3.0 to 4.0.

Examples

HTML template:

<form jwcid="form@Form" success="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="image" src="images/login.png"/>
      <input type="image" jwcid="help@ImageSubmit" action="listener:doHelp" image="asset:help/>
    </td>
  </tr>
</table>
</form>

Page specification:


. . .

  <asset name="help" path="images/help.png"/>

. . .

This is a variation of the example for the Submit component; it uses images instead of ordinary clickable buttons for the help and login actions.