Today I noticed a strange behaviour of T4's EventListeners. I wanted an Any component which renders as a button to submit a form and call my listener method after form submission. The docs say that's what the EventListener's submitForm parameter is for. So I went about and wrote an EventListener, targeted it at my Any component, made it listen to the onclick event and set submitForm to my form. When I tested my work nothing at all happened. I then checked the generated HTML and found that Tapestry did not generate any event connection code. When I removed the submitForm parameter it suddenly did and my listener method got called the way it's supposed to.

I dived into T4's sources and found out the following:

In ComponentEventConnectionWorker Tapestry stores a list of event connections to form components which are not rendered yet and renders those when the corresponding form component gets rendered. It stores those connections in a Map and uses the form's _id_ as a key (in filterFormEvents on line 412). It then checks all components whether they got deferred connections to be set up by querying the map using the component's _extended id_ and therefore never finds any deferred connections for any component. I changed isDeferredForm, linkDeferredForm and mapFormNames to use the form's id and suddenly Tapestry generates the connection setup javascript code and my form's submit listener gets called.

But my listener methods which I annotated with the EventListener annotation still don't get called.

I therefore suspect that something is seriously wrong with the event setup and handling code. Others have also experienced this: https://issues.apache.org/jira/browse/TAPESTRY-1128 is at least partially connected to this.

Please help me: Am I just an idiot or is it really Tapestry which is not acting as it's supposed to?

Uli

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to