On 02.10.2007, at 11:29, Catarina Vieira Simoes wrote:

I'd like to use the ERXValidationFactory class to validate forms but I couldn't quite figure how to catch the possible thrown validation exceptions in the action associated with the form. Could you please help me with some informations (and best practices) about how the class works and how to use it to properly validate a generic form.

First of all, I wouldn't start with looking at ERXValidationFactory, but with standard validation methods in WebObjects.

Step 1:

Implement

        public void validationFailedWithException (
                        java.lang.Throwable exception,
                        java.lang.Object value,
                        java.lang.String keyPath) {
        

in your component, collect the errors from there in an array, surround your saveChanges call with a try catch block and show the list of errors on reload.

If that works, you can start digging deeper. In your EOs you can throw normal EOValidation.ValidationException objects, you should look at the strings file in ERExtensions for the messages and so on.

A really good help, whether you use Wonder or not, is Chuck's book on that topic.

cug
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to