Hello, I am trying to solve the issue where an AJAX request is expecting back JSON structure as oppose to html snippet and validation errors happen in generic way. The book's example does not cover such case - it shows case when client expects valid HTML, thus forwarding to a page containing <s:errors/> works in case of validation error.
Is there a *nice* way of handling a case when client expects JSON objects but the form it posts has invalid data? The only way I could think of is converting ValidationErrors to JSON structure and returning it back to the caller and caller needs to be smart enough to figure out how to display global/field validations errors on the page. This sounds a bit clunky, especially on the front end. Perhaps, something can be done at the client side, where it can check if the return object is "html" and behave differently (write to a div) but I am still not sure how it would handle form field specific errors.
------------------------------------------------------------------------------
_______________________________________________ Stripes-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/stripes-users
