Re: Postponed validation possible?
Re: Postponed validation possible?
- Subject: Re: Postponed validation possible?
- From: Lachlan Deck <email@hidden>
- Date: Thu, 12 Nov 2009 08:39:48 +1100
On 12/11/2009, at 7:16 AM, Chuck Hill wrote:
On Nov 11, 2009, at 10:39 AM, Riccardo De Menna wrote:
I'd like some help in figuring out if what I'm doing has dangerous
implications.
EOF objects that are edited in WOComponents go through two
validations for what I see.
The first is done on assignment by WOComponent and the second by
EOCustomObject on save.
This can sometimes hamper my ui as for example when using tabs to
edit values of a complex EO in steps. Having validation to occur on
assignment right away means that my user can't leave a tab if he
has not filled the mandatory fields of a new object. And it might
be convenient to let him do it sometimes and just check everything
when he pushes the save button.
So I added the following to my 'common' EOGenericRecord subclass:
public boolean postponeValidation() {
return false;
}
@Override
public Object validateTakeValueForKeyPath(Object value, String
keyPath) {
if ( postponeValidation() ) {
takeValueForKeyPath( value, keyPath );
return value;
}
return super.validateTakeValueForKeyPath(value,keyPath);
}
My eo's can override the postponeValidation and return true to
force assignments to occur anyway and just leave it to the save-
validation to catch any errors.
Am I doing something I will regret here? Can you foresee problems
in using such practice?
AFAIK validateTakeValueForKeyPath is only used by bindings during
the takeValuesFromRequest phase of the RR loop. What you are doing
should be safe.
Chuck needs more Coffee :-)
with regards,
--
Lachlan Deck
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden