You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Carlos F <ca...@yahoo.com> on 2008/03/17 19:25:29 UTC

@EventListener - SubmitForm element

<background>
I am displaying a tabular list of records inside of a form.  Each row in the tabular list includes a checkbox, an up and down arrow image and info about the detail record in question.  When the user clicks on the up and down arrow image the detailed record should be resorted in a backing list and the tabular list should be redisplayed.  This was easily enough using a DirectLink with the asyn property.  However, I need to maintain the state of the checkbox.  This has lead me to using the @EventListener with the "SubmitForm" element.

Because I need to pass along information about the detail record being reordered I am using the "Accessing intercepted functions' parameters on the server-side" form of the @EventListener.  The parameter I am passing is the index position of the detail record being moved.
</background>

I have a few questions about @EventListener.

1 - is the "submitForm" element only intended to be used when the "targets" parameter includes a component that implements IFormComponent?

When my @EventListener targets an Any (wraps image) and Button component the eventlistener method is triggered when the event occurs for either component.  When I target just the Any component the eventlistener method is skipped (as is the form's listener).  This seems to be because the eventlistener method is not registered as a formEventListener with the IComponentEventInvoker -- even though the "submitForm" element is specified.

2 - is there a way to declare that the @EventListener should bypass the form's listener method?  E.g. I want the overall form data to be submitted to the server because it will effect how a component will be rendered by "cycle.getResponseBuilder().updateComponent(fooComponentId)".  Currently I just have the eventListener method set a flag that short circuits the subsequent call to the form's listener method.  Is the order that the are triggered in guranteed?  e.g. will my listenermethod always be invoked prior to the form's event listener?

Carlos