LinkSubmitOnce

Description

Renders an LinkSubmit 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

LinkSubmit

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.
disabled boolean no false Controls whether the link is produced. If disabled, the portion of the template the link surrounds is still rendered, but not the link itself.
selected java.lang.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 java.lang.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 link 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 java.lang.String - [submit,cancel,refresh] no 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: Allowed
  • Informal parameters: Allowed
  • Reserved parameters: href, name

Requirements

This component extends the LinkSubmit component of Tapestry.

Example

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

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

<a jwcid="@bayeux:LinkSubmitOnce" href="#" onclick="return myOwnClientValidation()" listener="listener:myListener">my action link<a>
                
<script type="javascript">
  function myOwnClientValidation() {
    //some client validation to be done here
    return true;
  }
</script>
                

public class APage extends BasePage {
    public void myListener(IRequestCycle cycle) {
        System.out.println("my linkSubmit is activated");
    }
}