Em Mon, 15 Dec 2008 17:10:43 -0300, Olle Hallin <olle.hal...@gmail.com> escreveu:

For example like this (very simplified):
@Component private Form myForm; // links to <t:form t:id="myForm">

@Component private PasswordField password1; // links to <t:passwordfield
t:id="password1">

Object onSuccess() {
  if (passwords unequal) {
    myForm.recordError(password1, "Passwords does not match");
    return null;
  }
  // else proceed with persisting the user
}

The injection of the form and the field and the error message recording are correct, but your suggestion of using the onSuccess() method isn't correct

Validation should be done at onValidateForm() (VALIDATE_FORM event), not at the onSuccess (SUCCESS event). The SUCCESS event is meant to be fired only if validation was ok.

--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to