>
> I read http://tapestry.apache.org/tapestry5/guide/event.html... and I
> understood that only pages can handle events... but I need the
> component handle the event. Any help? Thanks in advanced, and sorry
> for my english!



Components can handle events as well. For pagination, you can create
EventLinks from within your component (
http://tapestry.apache.org/tapestry5.1/tapestry-core/ref/org/apache/tapestry5/corelib/components/EventLink.html
).

When the user clicks on them, the event-handler on your component is called.
You can use the context parameter to provide a page-number to jump to for
example and the event-parameter to set the event you want to respond to.
Then the on[EVENT] method is called on your component.

The problems I've had in the beginning with event-handling in Components
mostly had to do with events only bubbling up.
If you setup the form-component on your page and then inside that form you
have a custom component that uses some fields, your custom component will
not get any of the form-events.
The form was setup on the page, so only the form itself and the page will
get those events. This is very tricky when you setup more complex reusable
component that need to perform cross-field validation. In those situations
one want to let the custom component handle complex validation using the
onSubmit-event, but your handler will never get called.

regards,

Onno

Reply via email to