On Nov 11, 2009, at 10:39 AM, Riccardo De Menna wrote:

Hi,

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


--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects







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

This email sent to arch...@mail-archive.com

Reply via email to