Right now we are using a basic HTML control to submit the registration form, but it takes very little effort to convert it into a Tapestry Submit
component. This is how it will look then:
<input type="submit" t:type="submit" t:id="submitButton" value="Submit"/>
We also need to add an event handler for this button to the Registration page class:
@OnEvent(component="submitButton") void onSubmitButton() { System.out.println("Submit button was pressed!"); // TODO: Some code to actually register the user }
Run the application, enter some values into the registration form and submit it by clicking on the button. You should see an output similar to this:
Setting user name: john Setting password: abc Setting gender: MALE Setting subscribe: false Submit button was pressed! The form was submitted!
The event handler for the submit control runs exactly before the form submission handler, and so all the values submitted by the user are available to it.
Now, to give the logic of the...