--- On Sun, 6/15/08, Karr, David <[EMAIL PROTECTED]> wrote:
> I'm now trying to explore doing an Ajax form submit,
> and getting a JSON response.  I'm using YUI on the 
> client side.  I'd like to see if I can get similar 
> data in the JSON response that I would in a normal
> submit, for instance, with field errors.

For S2.0's JSON result just add getters for the error methods and they'll be 
serialized along with the rest (oh, snap!) of the action. I'm not as familiar 
with the RESTful plugin's JSON serilization but would suspect/assume it's 
similar.

> I would have thought the "input" parameter wouldn't 
> be relevant in a Ajax/JSON action.

Not sure how it would know the difference, since the JSON part is the result, 
not the action, but it might be different in S2.1 (I've tested the plugin to 
some extent but haven't used t in the real world yet.)

> I guess there's no automatic provision for reporting field 
> errors in a JSON response, so I guess I'll have to build 
> something like that by hand?

See the above.

> onsubmit="return YAHOO.strutsform.submitform();; return true;"
> 
> I'm not sure if that "return true;" will cause me trouble, 
> as I'm trying to bypass the normal form submission.  
> I think by returning false from "submitform", I achieved 
> that, however.

Unless your JavaScript implementation is very, horribly broken, the first 
return will act like a return.

Also note that once you're mucking about with Ajax requests you have to handle 
session expiration and exceptions in a more useful way; great fun, great fun.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to