As usual, I'm sure I'm just missing something here... I can't quite figure how to do validation of a custom component. I basically want to do what is described here[0] about using onSuccess(), but in a component rather than a page. I basically have a PasswordForm component which itself has a form, and that needs to verify that the "password" and "confirm password" fields are equal. I'm able to do this validation in PasswordForm.onSuccess() without any trouble....

String onSuccess() {
    if (!password.equals(password2)) {
        log.error("Passwords don't match");
        form.recordError("Passwords don't match");
        return null;
    }
}

but how do I notify the containing page that there is an error? Currently, the page just moves right along after logging my error message. I've tried throwing a ValidationException from onSuccess(), but that ends up being displayed to the user with a stacktrace and all. I even looked at the standard Form component's onAction method and copied some stuff from there (specifically looking at _resources.triggerEvent(FAILURE, context, handler)) but that didn't help at all. I separately tried extending AbstractField and overriding processSubmission() as suggested in one post, but that didn't do much for me.

Any suggestions would be much appreciated.

[0]: http://tapestry.apache.org/tapestry5/tapestry-core/guide/validation.html

-will

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to