RE: Validate without submit?

2010-05-03 Thread Martin Gainty

can you supply
1)all jsps
2)struts-default.xml specifically everything between


and everything between

   




3)relevant action classes
4)relevant pojos such as backing beans etc.

thanks,
Martin Gainty 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




> Date: Mon, 3 May 2010 13:14:30 -0500
> Subject: Re: Validate without submit?
> From: ozu.na...@gmail.com
> To: d...@newfield.org
> CC: user@struts.apache.org; cimba...@cimballi.net
> 
> More info...  This is getting more confusing to me by the minute.
> 
> If I use these interceptors as such in my action:
> 
> 
> 
> 
> 
> It appears that the parameters are not being parsed correctly.  I
> don't know that for sure, but I suspect that is the case because all
> validation fails and all messages are returned.  The success method of
> the ajax call is never fired, instead the completed method is fired
> with the parseerrror as the textstatus.
> 
> If I use the basicStack and include the "paramsPrepareParamsStack",
> the success method of the ajax is called, and no errors are returned
> -- even though there should be an error for a missing field.  If I
> then supply the value to the missing field and try to revalidate, the
> ajax call never fires success, instead it fires complete with a
> parseerror.  In both cases with the paramsPrepareParamsStack, no
> validation errors are being returned correctly.
> 
> I'm quite confused with this and would appreciate any advice or help
> anyone has to offer.
> 
> 
> On Mon, May 3, 2010 at 12:08 PM, Ozu Natsu  wrote:
> > The params interceptor is in the stack, I had included the basicStack
> > -- but also expressly included it as well to see if there was a
> > difference in behavior.  In FF I can see the query string of the form
> > elements for the request, so I am sure that they are being passed.
> > The paramter string looks like I would expect:
> > object.attribute=value&object.attribute2=value
> >
> > Where is the best way to verify that the action is getting and parsing
> > the parameters in the action?
> >
> > On Sat, May 1, 2010 at 8:45 PM, Dale Newfield  wrote:
> >> On 5/1/10 11:58 AM, Ozu Natsu wrote:
> >>>
> >>> I'm also puzzled why the JSONValidationInterceptor
> >>> validationAware.hasErrors() is always returning the entire validation
> >>> rule set.
> >>
> >> Is params in the interceptor stack?
> >> Are the arguments being passed?  (Look at the request from the client side
> >> with firefox.)  Are the arguments arriving at the server?  Are they being
> >> processed correctly?
> >>
> >> -Dale
> >>
> >
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
  
_
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

Re: Validate without submit?

2010-05-03 Thread Ozu Natsu
More info...  This is getting more confusing to me by the minute.

If I use these interceptors as such in my action:





It appears that the parameters are not being parsed correctly.  I
don't know that for sure, but I suspect that is the case because all
validation fails and all messages are returned.  The success method of
the ajax call is never fired, instead the completed method is fired
with the parseerrror as the textstatus.

If I use the basicStack and include the "paramsPrepareParamsStack",
the success method of the ajax is called, and no errors are returned
-- even though there should be an error for a missing field.  If I
then supply the value to the missing field and try to revalidate, the
ajax call never fires success, instead it fires complete with a
parseerror.  In both cases with the paramsPrepareParamsStack, no
validation errors are being returned correctly.

I'm quite confused with this and would appreciate any advice or help
anyone has to offer.


On Mon, May 3, 2010 at 12:08 PM, Ozu Natsu  wrote:
> The params interceptor is in the stack, I had included the basicStack
> -- but also expressly included it as well to see if there was a
> difference in behavior.  In FF I can see the query string of the form
> elements for the request, so I am sure that they are being passed.
> The paramter string looks like I would expect:
> object.attribute=value&object.attribute2=value
>
> Where is the best way to verify that the action is getting and parsing
> the parameters in the action?
>
> On Sat, May 1, 2010 at 8:45 PM, Dale Newfield  wrote:
>> On 5/1/10 11:58 AM, Ozu Natsu wrote:
>>>
>>> I'm also puzzled why the JSONValidationInterceptor
>>> validationAware.hasErrors() is always returning the entire validation
>>> rule set.
>>
>> Is params in the interceptor stack?
>> Are the arguments being passed?  (Look at the request from the client side
>> with firefox.)  Are the arguments arriving at the server?  Are they being
>> processed correctly?
>>
>> -Dale
>>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-05-03 Thread Ozu Natsu
The params interceptor is in the stack, I had included the basicStack
-- but also expressly included it as well to see if there was a
difference in behavior.  In FF I can see the query string of the form
elements for the request, so I am sure that they are being passed.
The paramter string looks like I would expect:
object.attribute=value&object.attribute2=value

Where is the best way to verify that the action is getting and parsing
the parameters in the action?

On Sat, May 1, 2010 at 8:45 PM, Dale Newfield  wrote:
> On 5/1/10 11:58 AM, Ozu Natsu wrote:
>>
>> I'm also puzzled why the JSONValidationInterceptor
>> validationAware.hasErrors() is always returning the entire validation
>> rule set.
>
> Is params in the interceptor stack?
> Are the arguments being passed?  (Look at the request from the client side
> with firefox.)  Are the arguments arriving at the server?  Are they being
> processed correctly?
>
> -Dale
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-05-01 Thread Dale Newfield

On 5/1/10 11:58 AM, Ozu Natsu wrote:

I'm also puzzled why the JSONValidationInterceptor
validationAware.hasErrors() is always returning the entire validation
rule set.


Is params in the interceptor stack?
Are the arguments being passed?  (Look at the request from the client 
side with firefox.)  Are the arguments arriving at the server?  Are they 
being processed correctly?


-Dale

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-05-01 Thread Ozu Natsu
Anyone following this thread -- here's where I am at:

The struts JSONValidationInterceptor seems to be munching the name of
the field to be validated at line 149/150:
sb.append(validationAware instanceof ModelDriven ?
fieldError.getKey().substring(6)
: fieldError.getKey());


My Action class is ModelDriven:
public class Myclass extends AdminSupport implements
ModelDriven, Preparable, UserAware {
...
}

I'm not sure why it is doing a substring(6) of the fieldError.getKey
--  but if I comment that out and use just the fieldError.getKey()
value, the JSON result gets sent back to the ajax "complete" callback.
 The textResult of the "callback" is still "parseerror", but it has a
valid response that can be passed to the StrutsUtils object for
parsing.

I'm also puzzled why the JSONValidationInterceptor
validationAware.hasErrors() is always returning the entire validation
rule set.  In other words, it is not seeing fields with valid values
vs. fields with invalid values.  I'm wondering if the validation
interceptor is also not finding the fields to validate and matching
them with the validation rules because of this fieldError key
business?

Struts Experts, what happing here??  I am I describing the problem well enough?



On Fri, Apr 30, 2010 at 6:34 PM, Ozu Natsu  wrote:
> Arg!
>
> Something else is going on. Maybe related to the parseError?  I am
> assuming the callback should be on the success function, not the
> error/complete.
>
> I replaced the jquery $('update')[0] reference with document.forms[0]
> and I get the exact same thing.  Moreover, it looks as if the
> errorsObect.fieldErrors has ALL my validations in it, regardless of
> whether the field had a value or not.
>
>
> On Fri, Apr 30, 2010 at 6:20 PM, Ozu Natsu  wrote:
>> The problem looks as if it is in the DOM, I'm wondering if this isn't
>> jquery's fault?
>>
>> All of the field names in the form.elements are somehow mangled.
>>
>> "artNumber" instead of "partNumber"
>>
>>
>> On Fri, Apr 30, 2010 at 6:14 PM, Ozu Natsu  wrote:
>>> Dale,
>>>
>>> So close! I am now to the point where I am getting the errors, but
>>> when I try to use the struts utilities to display them, I am getting
>>> an undefined object in the struts validation.js function
>>> addErrorXHTML(e, errorText) ;
>>>
>>> My code looks like this:
>>>
>>>                complete : function(XMLHttpRequest, textStatus){
>>>                        var form= $('#update')[0];
>>>                        //clear previous validation errors, if any
>>>                    StrutsUtils.clearValidationErrors(form);
>>>
>>>                    //get errors from response
>>>                    var text = XMLHttpRequest.responseText;
>>>                    var errorsObject = StrutsUtils.getValidationErrors(text);
>>>
>>>                     //show errors, if any
>>>                    if(errorsObject.fieldErrors) {
>>>                       StrutsUtils.showValidationErrors(form, errorsObject);
>>>                    }
>>>                }
>>>
>>>
>>> On Fri, Apr 30, 2010 at 5:55 PM, Dale Newfield  wrote:
 On 4/30/10 6:50 PM, Ozu Natsu wrote:
>
> Anyone have any ideas?

 Debugging from the client side:  Firebug in Firefox.
 Debugging from the server side:  log messages (log4j or other).

 -Dale

>>>
>>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Ozu Natsu
Arg!

Something else is going on. Maybe related to the parseError?  I am
assuming the callback should be on the success function, not the
error/complete.

I replaced the jquery $('update')[0] reference with document.forms[0]
and I get the exact same thing.  Moreover, it looks as if the
errorsObect.fieldErrors has ALL my validations in it, regardless of
whether the field had a value or not.


On Fri, Apr 30, 2010 at 6:20 PM, Ozu Natsu  wrote:
> The problem looks as if it is in the DOM, I'm wondering if this isn't
> jquery's fault?
>
> All of the field names in the form.elements are somehow mangled.
>
> "artNumber" instead of "partNumber"
>
>
> On Fri, Apr 30, 2010 at 6:14 PM, Ozu Natsu  wrote:
>> Dale,
>>
>> So close! I am now to the point where I am getting the errors, but
>> when I try to use the struts utilities to display them, I am getting
>> an undefined object in the struts validation.js function
>> addErrorXHTML(e, errorText) ;
>>
>> My code looks like this:
>>
>>                complete : function(XMLHttpRequest, textStatus){
>>                        var form= $('#update')[0];
>>                        //clear previous validation errors, if any
>>                    StrutsUtils.clearValidationErrors(form);
>>
>>                    //get errors from response
>>                    var text = XMLHttpRequest.responseText;
>>                    var errorsObject = StrutsUtils.getValidationErrors(text);
>>
>>                     //show errors, if any
>>                    if(errorsObject.fieldErrors) {
>>                       StrutsUtils.showValidationErrors(form, errorsObject);
>>                    }
>>                }
>>
>>
>> On Fri, Apr 30, 2010 at 5:55 PM, Dale Newfield  wrote:
>>> On 4/30/10 6:50 PM, Ozu Natsu wrote:

 Anyone have any ideas?
>>>
>>> Debugging from the client side:  Firebug in Firefox.
>>> Debugging from the server side:  log messages (log4j or other).
>>>
>>> -Dale
>>>
>>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Ozu Natsu
The problem looks as if it is in the DOM, I'm wondering if this isn't
jquery's fault?

All of the field names in the form.elements are somehow mangled.

"artNumber" instead of "partNumber"


On Fri, Apr 30, 2010 at 6:14 PM, Ozu Natsu  wrote:
> Dale,
>
> So close! I am now to the point where I am getting the errors, but
> when I try to use the struts utilities to display them, I am getting
> an undefined object in the struts validation.js function
> addErrorXHTML(e, errorText) ;
>
> My code looks like this:
>
>                complete : function(XMLHttpRequest, textStatus){
>                        var form= $('#update')[0];
>                        //clear previous validation errors, if any
>                    StrutsUtils.clearValidationErrors(form);
>
>                    //get errors from response
>                    var text = XMLHttpRequest.responseText;
>                    var errorsObject = StrutsUtils.getValidationErrors(text);
>
>                     //show errors, if any
>                    if(errorsObject.fieldErrors) {
>                       StrutsUtils.showValidationErrors(form, errorsObject);
>                    }
>                }
>
>
> On Fri, Apr 30, 2010 at 5:55 PM, Dale Newfield  wrote:
>> On 4/30/10 6:50 PM, Ozu Natsu wrote:
>>>
>>> Anyone have any ideas?
>>
>> Debugging from the client side:  Firebug in Firefox.
>> Debugging from the server side:  log messages (log4j or other).
>>
>> -Dale
>>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Ozu Natsu
Dale,

So close! I am now to the point where I am getting the errors, but
when I try to use the struts utilities to display them, I am getting
an undefined object in the struts validation.js function
addErrorXHTML(e, errorText) ;

My code looks like this:

complete : function(XMLHttpRequest, textStatus){
var form= $('#update')[0];
//clear previous validation errors, if any
StrutsUtils.clearValidationErrors(form);

//get errors from response
var text = XMLHttpRequest.responseText;
var errorsObject = StrutsUtils.getValidationErrors(text);

 //show errors, if any
if(errorsObject.fieldErrors) {
   StrutsUtils.showValidationErrors(form, errorsObject);
}
}


On Fri, Apr 30, 2010 at 5:55 PM, Dale Newfield  wrote:
> On 4/30/10 6:50 PM, Ozu Natsu wrote:
>>
>> Anyone have any ideas?
>
> Debugging from the client side:  Firebug in Firefox.
> Debugging from the server side:  log messages (log4j or other).
>
> -Dale
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Dale Newfield

On 4/30/10 6:50 PM, Ozu Natsu wrote:

Anyone have any ideas?


Debugging from the client side:  Firebug in Firefox.
Debugging from the server side:  log messages (log4j or other).

-Dale

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Ozu Natsu
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  wrote:
> I noticed that I am not using the json interceptor, only the result :
> 
>
> What are you using ?
>
> Cimballi
>
>
> On Fri, Apr 30, 2010 at 5:16 PM, Ozu Natsu  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  wrote:
>>> Did you try with the getJSON method of JQuery ?
>>>
>>> Cimballi
>>>
>>>
>>> On Fri, Apr 30, 2010 at 5:01 PM, Ozu Natsu  wrote:
 1 step closer. I had missed the reference to the interceptor
  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  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  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



Re: Validate without submit?

2010-04-30 Thread Cimballi
I noticed that I am not using the json interceptor, only the result :


What are you using ?

Cimballi


On Fri, Apr 30, 2010 at 5:16 PM, Ozu Natsu  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  wrote:
>> Did you try with the getJSON method of JQuery ?
>>
>> Cimballi
>>
>>
>> On Fri, Apr 30, 2010 at 5:01 PM, Ozu Natsu  wrote:
>>> 1 step closer. I had missed the reference to the interceptor
>>>  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  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  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



Re: Validate without submit?

2010-04-30 Thread Ozu Natsu
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  wrote:
> Did you try with the getJSON method of JQuery ?
>
> Cimballi
>
>
> On Fri, Apr 30, 2010 at 5:01 PM, Ozu Natsu  wrote:
>> 1 step closer. I had missed the reference to the interceptor
>>  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  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  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/
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Cimballi
Did you try with the getJSON method of JQuery ?

Cimballi


On Fri, Apr 30, 2010 at 5:01 PM, Ozu Natsu  wrote:
> 1 step closer. I had missed the reference to the interceptor
>  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  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  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/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Ozu Natsu
1 step closer. I had missed the reference to the interceptor
 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  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  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/
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Cimballi
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  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/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Ozu Natsu
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.

On Fri, Apr 30, 2010 at 3:07 PM, Cimballi  wrote:
> I have something like that in the page :
>
> $.getJSON("...",
>  function(json) {
>    if (json.result == "OK") {
>      ...
>    } else {
>      ...
>    }
>  });
>
> And in the action I have this :
>    public String getResult() {
>        return this.result;
>    }
>
> In my case it's a single String but I suppose you can return more
> complex objects.
>
> Cimballi
>
>
> On Fri, Apr 30, 2010 at 2:51 PM, Ozu Natsu  wrote:
>> I am having some problems with the call, the ajax "get" returns no
>> response, even though I know the form validation should be failing.
>> My ajax call looks like this:
>>
>>
>>        var url= "./checkValid.do";
>>        $.ajax({
>>                type    : "GET",
>>                cache   : false,
>>                dataType: "json",
>>                url      url,
>>                data    : 
>> $(this).serialize()+'&struts.enableJSONValidation=true&struts.validateOnly=true',
>>                success: function(data, textStatus, XMLHttpRequest) {
>>                        // do something here
>>                        alert(textStatus);
>>                }
>>        });
>>
>>
>> My action looks like this:
>>          
>>            
>>                jsonData
>>            
>>          
>>
>> Am I missing something?
>
>
> --
> 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



Re: Validate without submit?

2010-04-30 Thread Cimballi
I have something like that in the page :

$.getJSON("...",
  function(json) {
if (json.result == "OK") {
  ...
} else {
  ...
}
  });

And in the action I have this :
public String getResult() {
return this.result;
}

In my case it's a single String but I suppose you can return more
complex objects.

Cimballi


On Fri, Apr 30, 2010 at 2:51 PM, Ozu Natsu  wrote:
> I am having some problems with the call, the ajax "get" returns no
> response, even though I know the form validation should be failing.
> My ajax call looks like this:
>
>
>        var url= "./checkValid.do";
>        $.ajax({
>                type    : "GET",
>                cache   : false,
>                dataType: "json",
>                url      url,
>                data    : 
> $(this).serialize()+'&struts.enableJSONValidation=true&struts.validateOnly=true',
>                success: function(data, textStatus, XMLHttpRequest) {
>                        // do something here
>                        alert(textStatus);
>                }
>        });
>
>
> My action looks like this:
>          
>            
>                jsonData
>            
>          
>
> Am I missing something?


-- 
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



Re: Validate without submit?

2010-04-30 Thread Ozu Natsu
I am having some problems with the call, the ajax "get" returns no
response, even though I know the form validation should be failing.
My ajax call looks like this:


var url= "./checkValid.do";
$.ajax({
type: "GET",
cache   : false,
dataType: "json",
url  url,
data: 
$(this).serialize()+'&struts.enableJSONValidation=true&struts.validateOnly=true',
success: function(data, textStatus, XMLHttpRequest) {
// do something here
alert(textStatus);
}
});


My action looks like this:
  

jsonData

  

Am I missing something?

On Fri, Apr 30, 2010 at 1:59 PM, Cimballi  wrote:
> Of course it can be done with JQuery and I recommend using JSON too.
> You call the action via Ajax and you get the JSON result and display it.
>
> Cimballi
>
>
> On Fri, Apr 30, 2010 at 1:36 PM, Ozu Natsu  wrote:
>> Is it possible to fire the struts 2 validation without performing a
>> submit?  I realize that this could be done via ajax, but I am already
>> committed to use another JS framework (not dojo, dwr or prototype) .
>> I'd like to fire the validation and get the form validation messages
>> back if any to be displayed on the page, as happens when the
>> validation is fired from a submit -- but without performing the
>> submit...
>>
>> Possible?  Stupid question?  Can it be done with jquery?
>>
>> Thank you in advance to any reply.
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>
>
>
> --
> 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
>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validate without submit?

2010-04-30 Thread Cimballi
Of course it can be done with JQuery and I recommend using JSON too.
You call the action via Ajax and you get the JSON result and display it.

Cimballi


On Fri, Apr 30, 2010 at 1:36 PM, Ozu Natsu  wrote:
> Is it possible to fire the struts 2 validation without performing a
> submit?  I realize that this could be done via ajax, but I am already
> committed to use another JS framework (not dojo, dwr or prototype) .
> I'd like to fire the validation and get the form validation messages
> back if any to be displayed on the page, as happens when the
> validation is fired from a submit -- but without performing the
> submit...
>
> Possible?  Stupid question?  Can it be done with jquery?
>
> Thank you in advance to any reply.
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>



-- 
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