Editor doesn't show server validation errors

50 views
Skip to first unread message

Jens

unread,
Oct 18, 2011, 2:44:34 PM10/18/11
to google-we...@googlegroups.com
In an example project I set up client side validation and server side validation. Both validations work as I receive ConstraintViolation instances if for example a person's name is null. 

When I call EditorDriver.setConstraintViolations(..) using the violations from client side validation the error will be shown by the editor. But when I use the violations received from the server they won't be shown because the editor receives an empty list in HasEditorErrors.showErrors().

Does anyone has an idea how this could happen?

For client side validation I use the proxy (RequestFactory) returned by SimpleBeanEditorDriver.flush(). Then I create a new RequestContext, clone that edited proxy and send the clone to the server for validation and saving. So one difference I can see is that the ConstraintViolation from the server does not reference the proxy that is currently edited by the EditorDriver. But could this be a problem?

-- J.

Jens

unread,
Oct 19, 2011, 5:55:06 AM10/19/11
to google-we...@googlegroups.com
After some debugging I found that cloning is the reason why server side validation errors are not pushed to editors. Server side validation creates ConstraintViolation instances with a reference to the validated proxy. But as I have a cloned proxy which gets saved and thus validated the ConstraintViolation has a reference to that clone. The editor framework fails to convert ConstraintViolation to EditorError because it does now know the clone found inside ConstraintViolation and could not retrieve a list of editor delegates from its internal data structure (see: SimpleViolation.pushViolations(): 117).

Not quite sure if I can solve this issue. I need the clone to be able to continuously edit the proxy while saving it in the background.

-- J. 
Reply all
Reply to author
Forward
0 new messages