Reinhard Poetz wrote:

Thank you!

This means that the service layer is aware of which widgets exist? I'm not sure if I (and especially my customer) likes this bi-directional dependency ...

I agree it's a bad idea for the service layer to know about the widgets. In our case there's a fairly simple correspondence between error types and widgets, so we're able to infer it all in the UI layer. For more complicated cases I could imagine using some kind of mapping, along the same sort of lines as the form bindings. I haven't tried that out, so I don't know how well it would work in practice.


BTW, the code to set a validation error on a widget looks like:

var myWidget = form.lookupWidget("...");
var myError = new Packages.org.apache.cocoon.forms.validation.ValidationError(myErrorMessage);
myWidget.setValidationError(myError);


(hope that doesn't get word-wrapped...)

Vil.

Reply via email to