In Tapestry5, I am having two submit buttons in the form and I want to perform Validation event as well, how can I achieve that ? This is what I am trying to do :
In page.tml
<form t:type="form" t:id="verifyCreateExampleModelForm">
<input class="btsubmit" t:type="submit" t:id="saveAsAwaitingCompletion" >
<input class="btsubmit" t:type="submit" t:id="saveAsCreated">
</form>
In page.class
@OnEvent(value = EventConstants.VALIDATE_FORM, component = "verifyCreateExampleModelForm")
private Object validation() {
if (StringUtils.isEmpty(modelTypeName)) {
verifyCreateExampleModelForm.recordError("incorrectmodelTypename"));
this.isAllowed = false;
}
}
@OnEvent(component = "saveAsAwaitingCompletion", value = "selected")
private void onSaveAsAwaitingCompletion() {
}
@OnEvent(component = "saveAsCreated", value = "selected")
private void onSaveAsCreated() {
}