Brain damage... My component superclass was doing this : public void awake() { session().setErrors(new NSMutableArray<String>()); }
So when SaveStatViewer was called, the array was empty... > Maybe drop all your validation handling into your page component > instead and then you can get at it with context.page? Extra bonus: > use the same page super class everywhere and your validation handling > > is done in one place for your entire app. (^_^) > > Ramsey > > On Nov 5, 2009, at 9:12 PM, Pascal Robert wrote: > > > I'm trapping validation errors like this : > > > > private String error; > > > > public void validationFailedWithException(Throwable exception, > > Object value, String keyPath) { > > errors.addObject(exception.getMessage()); > > } > > > > public String error() { > > return error; > > } > > > > public void setError(String error) { > > this.error = error; > > } > > > > And in my component, I had this : > > > > <wo:AjaxUpdateContainer id = "saveState" fullSubmit = true> > > <wo:ERXWOConditional condition = "$hasErrors"> > > <div class = "warning"> > > <p><wo:ERXLocalizedString value = "Errors.Header" />:</p> > > <wo:WORepetition list = "$errors" item = "$error"> > > <wo:WOString value = "$error" escapeHTML = "false" /> > > <br /> > > </wo:WORepetition> > > </div> > > </wo:ERXWOConditional> > > <wo:ERXElse> > > <wo:WOString value = "$succesString" /> > > </wo:ERXElse> > > </wo:AjaxUpdateContainer> > > > > That was working fine when this code was directly in my components, > > > but having the same stuff inside multiple components is not good, so > > > I moved this logic to a sub-component, and I'm calling this sub- > > component from all my other components. Problem is, the sub- > > component is called (if I put static text before the conditional, I > > > see it when I submit the form) but no errors are showing up and the > > > repetition don't iterate over the array. A breakpoint in > > validationFailedWithException does show that the error is being > > added to the array, so I have no idea on why it's not displaying > > anything when it's in the sub-component. > > > > BTW, validationFailedWithException is inside a superclass that every > > > component inherits from. > > > > WO 5.4.3/ERExtensions from the current source. > > > > -- > > > > ------------------------------------------------------- > > Pascal Robert > > > > http://www.macti.ca > > http://www.linkedin.com/in/macti > > > > Skype: MacTICanada > > AIM/iChat : MacTICanada > > _______________________________________________ > > 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/rgurley > > %40mac.com > > > > This email sent to rgur...@mac.com -- ------------------------------------------------------- Pascal Robert http://www.macti.ca http://www.linkedin.com/in/macti Skype: MacTICanada AIM/iChat : MacTICanada _______________________________________________ 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