I've tried both json result type and what the docs use: http://struts.apache.org/2.0.14/docs/ajax-validation.html. No luck.
I just added an onComplete event handler and I see that i am getting textStatus passed as parseError.??? So the success event handler is not being called because of some error. I'm not sure how to figure out what error it is. Anyone have any ideas? On Fri, Apr 30, 2010 at 5:36 PM, Cimballi <cimba...@cimballi.net> wrote: > I noticed that I am not using the json interceptor, only the result : > <result-type name="json" class="org.apache.struts2.json.JSONResult" /> > > What are you using ? > > Cimballi > > > On Fri, Apr 30, 2010 at 5:16 PM, Ozu Natsu <ozu.na...@gmail.com> wrote: >> var url= "./checkValid.do"; >> var data= >> $('#update').serialize()+'&struts.enableJSONValidation=true&struts.validateOnly=true'; >> $.getJSON( url, data, function(data, textStatus) { >> // Do something >> alert(textStatus); >> }); >> >> The callback defined as function(data, textStatus){...} never gets >> invoked. Same with the call to the ajax get. I simply see the get >> request in the FireFox console with the reply. >> >> On Fri, Apr 30, 2010 at 5:05 PM, Cimballi <cimba...@cimballi.net> wrote: >>> Did you try with the getJSON method of JQuery ? >>> >>> Cimballi >>> >>> >>> On Fri, Apr 30, 2010 at 5:01 PM, Ozu Natsu <ozu.na...@gmail.com> wrote: >>>> 1 step closer. I had missed the reference to the interceptor >>>> <interceptor-ref name="jsonValidationWorkflowStack"/> in my struts >>>> action. >>>> >>>> I am now getting a result back from the validator, but it doesn't seem >>>> to be firing my callback method. Can anyone help with this problem? >>>> >>>> Thank you! >>>> >>>> >>>> >>>> On Fri, Apr 30, 2010 at 3:45 PM, Cimballi <cimba...@cimballi.net> wrote: >>>>> Ozu, nut sure to be able to help you more. >>>>> I know how to call an action in Ajax, now it seems you want to >>>>> reproduce Struts2 validation process using Ajax and this requires more >>>>> analysis. >>>>> What you can do at least is do the validation in you main action >>>>> method. And even better, I think you could even specify the name of >>>>> the method to call in your action. >>>>> Another option is to create 2 actiosns in your configuration file >>>>> calling the same java action, one for the real action, and the other >>>>> for the validation. >>>>> >>>>> Cimballi >>>>> >>>>> >>>>> On Fri, Apr 30, 2010 at 3:34 PM, Ozu Natsu <ozu.na...@gmail.com> wrote: >>>>>> Closer, still not working... I had 2 problems (I think). >>>>>> #(this).serialize() was not serializing the form data. I put my form >>>>>> name in for the selector and now the form data is being passed to the >>>>>> get. I think the other problem is that the action method doesn't match >>>>>> my validator name. My validator is set up as >>>>>> Action-update-validation.xml. So I added method ="update" to the >>>>>> struts action definition. Now it appears to be trying to peform the >>>>>> update instead of just performing the validation. >>>>>> >>>>>> What exactly should be the chain of events happening here? Shouldn't >>>>>> it be something like the get invokes the validate() method, which >>>>>> returns json data to the javascript callback where my alert is at? I >>>>>> would have suspected my callback method data to be populated with the >>>>>> validation results. >>>>> >>>>> -- >>>>> Cimballi >>>>> JAVA J2EE Freelance >>>>> http://cimballi.elance.com/ >>>>> >>>> >>>> >>> >>> >>> >>> -- >>> Cimballi >>> JAVA J2EE Freelance >>> http://cimballi.elance.com/ >>> >> > > > > -- > Cimballi > JAVA J2EE Freelance > http://cimballi.elance.com/ > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org