-
Book Overview & Buying
-
Table Of Contents
Tapestry 5: Building Web Applications
Previously, while writing a Form submission handler, we used either an annotation like this:
@OnEvent(value="submit", component="registrationForm")
or an appropriately named method like onSubmitFromRegistrationForm().
As you already know, this means that the event handler method should be invoked in response to the submit event generated by the component with a specified ID. The Form component generates a few other events too. There are three events related to validation—validate, success, and failure. Let's implement event handler methods for all these events.
This is where following the naming convention for event handlers, as opposed to using the @OnEvent annotation, will save us some effort. If Tapestry will find a method named onSuccess() in the page class, it will understand that this is the event handler for any success event that happens on the page. Let's modify the existing handler for the submit event and add handlers for the other events...
Change the font size
Change margin width
Change background colour