[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Validation exceptions
Catching the EOValidationException is done by overriding the following
method inside your component:
public void validationFailedWithException(java.lang.Throwable exception,
java.lang.Object value, java.lang.String keyPath)
So that basically, you can catch it and do whatever processing you want.
You'll probably want to look at the exception to make sure that it's the
right one (if you have multiple validate functions in your EO). The key
level validation is also done during super's implementation of
validateForSave in your EO. But ya, the default implementation of
validationFailedWithException() just ignores the error.
At 01:52 PM 6/21/99 -0700, Art Isbell wrote:
> Our EOF model includes several entities with required (i.e., non-null)
>attributes. For example, CreditCard's cardNumber attribute must not be
>null.
>
> In our WO app, we would like to be able to set a Purchase object's
>creditCard relationship to nil and delete the credit card by setting its
>cardNumber to nil (e.g., by erasing the number in the cardNumber
>WOTextField). When we save, an EOValidationException is raised as
>expected. I have overridden takeValuesFromRequest:inContext: in the
>component whose changes are being saved and have called super's
>implementation in an exception handling domain. In the handler, I
>implement the credit card deletion. However, some other WO object
>catches the exception so my handler is never invoked.
>
> Can someone suggest a way to do this without the need to add "Delete"
>buttons for any objects that we want to delete?
>
>--
>Art Isbell
>Applications Programmer/Analyst
>Cheap Tickets, Inc.
>1440 Kapiolani Boulevard, #800
>Honolulu, HI 96814
>Voice: 1+808-945-7439
>Fax: 1+808-945-0610
>aisbell@cheaptickets.com
>www.cheaptickets.com
>
Derek Eide
Web Programmer
EyeWire, Inc. ( http://www.eyewire.com )
(403) 750-4297