Validation exceptions

Hello everybody,

I am trying to validate a form with custom validators, but the tricky part is that I want to validate the entire object (not field by field). I want to this to enable dependend fields (e.g. the firstname of a person can not be longer then the lastname).

So I made a commithandler and validate the object in the postcommit.
Now the problem is I want to show the errors in the form next to the correct fields. Is there any way to do so?
My validator gives back an array of InvalidValueExceptions but the commithandler encloses it in a commit exception.

Can I have the same behaviour as validation on the field level (The component error is set automatically when a field validation throws an exception).

Kind regards

Jonathan

In an item level CommitHandler, the framework cannot know which field an error would apply to. Thus, your CommitHandler needs to set the component errors explicitly in this case.

(Disclaimer: I haven’t tested this.)