ImageSubmitOnce

Description

Renders an ImageSubmit component with an onclick event handler that prevents the user from activating the link twice. The component acts together with other SubmitOnce,ImageSubmitOnce,DirectLinkOnce or LinkSubmitOnce components, which means that non of the mentioned components can be activated while another component request is processed.

See also

ImageSubmit

Parameters

Name Type Required Default Description
onclick java.lang.String no An optional onclick eventhandler that is to be processed prior to any activation of the link, but after the components own check to se if any other request from a SubmitOnce,ImageSubmitOnce,DirectLinkOnce or LinkSubmitOnce component is being processed.
image IAsset yes The normal image to display for the button.
name String 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 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 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 no Set to the coordinates of the clicked point within the image.
selected Object 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 no Tag used with the selected parameter to indicate which Submit button on a form was clicked.
listener IActionListener 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 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 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.

Further info

  • Body: Removed
  • Informal parameters: Allowed
  • Reserved parameters: type, name

Requirements

This component extends the ImageSubmit component of Tapestry.

Example

Presuming you have defined bayeux library in you application under the library name "bayeux":

Insert a ImageSubmit that executes a userdefined onclick event, and prevents more than one click from the user: "..."

<input type="image" jwcid="help@bayeux:ImageSubmitOnce" onclick="return myOwnClientValidation()" action="listener:myListener" image="asset:help"/>
                
<script type="javascript">
  function myOwnClientValidation() {
    //some client validation to be done here
    return true;
  }
</script>
                

public abstract class APage extends BasePage {
    public void myListener(IRequestCycle cycle) {
        System.out.println("my directlink is activated");
    }
}
                
Page specification:
<asset name="help" path="images/help.png"/>