Image Component Index Insert

ImageSubmit
org.apache.tapestry.form.ImageSubmit
Submit

Description
Provides an image button inside a Form. Clicking the button submits the form and may notify a configured listener or select property.

The Point parameter can be used to determine where on the image the user clicked.

In typical use, the application needs to know which ImageSubmit was the one clicked by the user. This can be accomplished in two ways:

  • Use the selected and tag parameters to identify the button.
  • Use the listener to perform an operation directly

If a listener is used, it will be invoked as the ImageSubmit component is rewound. In addition, the Form's listener will invoked if it is defined.

Use the first method if you need to be sure that the entire form has rewound before any logic specific to the ImageSubmit is triggered.

See Also
Form, Image, Submit
Parameters
Name Type Direction Required Default Description
image IAsset in yes   The image to show.
name String in no   The name to use for the form element. Under Netscape Navigator 4, this name becomes the tooltip. The name may be modified (by adding a number to the end) to ensure that it is unique within the form.
disabled boolean in no false If set to true, the button will be disabled (will not respond to the mouse). If an alternate image is defined, it will be displayed (typically a greyed-out version of the normal image).
disabledImage IAsset in no   An alternate image to display if the component is disabled. If the component is disabled and this parameter is not specified, the normal image is used.
point Point out no   The point at which the image was clicked; used for rare components that actually need to know (typically, using the image button list a simple image map).
selected Object out no   This parameter is bound to a property that is updated when the image button is clicked by the user (submitting the form). The property is updated to match the tag parameter.
tag Object in no   Tag used with the selected parameter to indicate which image button on a form was clicked. This parameter is required if the selected paremeter is used.
listener IActionListener in no   If specified, the listener is notified. This notification occurs as the component is rewound, i.e., prior to the form's listener. In addition, the selected property (if bound) will be updated before the listener is notified.

Body: removed
Informal parameters: allowed
Reserved parameters: "src", "type", "border"

Examples

This example uses the ImageSubmit to provide two form processing priority image buttons.

Standard Submit Urgent Submit
<form jwcid="@Form">
  <img jwcid="@ImageSubmit" image="ognl:assets.standardImage" listener="ognl:listeners.standardSubmit" alt="Standard Submit"/>
  <img jwcid="@ImageSubmit" image="ognl:assets.urgentImage" listener="ognl:listeners.urgentSubmit" alt="Urgent Submit"/>
</form>


<private-asset name="standardImage" resource-path="/com/mycorp/intray-green.png"/>
<private-asset name="urgentImage" resource-path="/com/mycorp/intray-red.png"/>


package com.mycorp;

public class FormPage extends BasePage {

    public void standardSubmit(IRequesCycle cycle) {
        // Process standard priority submit.    
        ..    
    }

    public void urgentSubmit(IRequesCycle cycle) {
        // Process urgent priority submit.    
        ..    
    }
}

Previous Home Next