Hi all,
I am trying to understand how to implement custom validation of form fields.
Here's what I've got so far:
CreateAccount.java:
public class CreateAccount {
@InjectComponent
private Form createAccountForm;
@OnEvent(value = "validate", component = "createAccountForm")
void validate() throws ValidationException {
log.debug("validate");
if (password == null || !password.equals(password2)) {
createAccountForm.getDefaultTracker().getErrors().add("passwords
don't match");
}
}
}
and CreateAccount.html:
<t:form t:id="createAccountForm">
<t:errors/>
<t:passwordfield t:id="password" t:validate="required,minLength=4"/>
<t:passwordfield t:id="password2" t:validate="required"/>
... etc
This is failing because Tapestry is trying to cast CreateAccount to Form...
but why? Am I going about this all wrong? What am I missing here?
I feel a bit like I am stumbling around in the dark. Does anybody know of
some T5 examples I can look at, just to get me going?
tia,
Marc
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]