Re: [Q] validation and "sticky invalid values"
Re: [Q] validation and "sticky invalid values"
- Subject: Re: [Q] validation and "sticky invalid values"
- From: Kaj Hejer <email@hidden>
- Date: Thu, 26 Jun 2003 23:14:26 +0200
At 08:21 +1200 27-06-2003, Andrew Lindesay wrote:
Hello;
A company I'm working with really wants to have the fields in a
component stick around in the case that a validation error occurs.
So, for example, some user enters some invalid values into a form
that is tied to an EO. Next they submit the values and those fields
are correctly validated as being broken. The EO does not actually
take up the values (as expected) and hence the unmodified values
appear in the response's outputted form again. Is there a "right"
way to get those values to get inserted into the EO regardless of
their validity or should I find some way to intercept the KVC
mechanism at the component level to achieve this? Of course I still
need the validation mechanism to run normally to avoid the EC from
attempting to persist invalid EO's.
Hi!
We use the following:
public Object validateTakeValueForKeyPath(Object value, String key)
throws NSValidation.ValidationException {
try {
super.validateTakeValueForKeyPath(value, key);
} catch (NSValidation.ValidationException e) {
if (key.equals("content")) {
setContent((String) value);
}
//...and so on for each field
}
return value;
}
but then you need some validate* methods to catch the validation
errors and throw ValidationException.
-Kaj :)
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.