Validation errors inside a sub-component
Validation errors inside a sub-component
- Subject: Validation errors inside a sub-component
- From: Pascal Robert <email@hidden>
- Date: Thu, 5 Nov 2009 21:12:57 -0500 (EST)
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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden