struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Nenning <Christoph.Nenn...@lex-com.net>
Subject RE: Textfield onchange --> handling ajax error response to show action errors
Date Wed, 02 Sep 2015 08:08:16 GMT
The documentation about ajax-validation might help you:

http://struts.apache.org/docs/ajax-validation.html


Basically you have to create JSON with 'errors' like this:

http://struts.apache.org/docs/ajax-validation.html#AJAXValidation-Howitworks


And you might use the JavaScript function 
StrutsUtils.showValidationErrors( ) to display them. Of course you must 
include struts utils.js to use that function.



regards,
Christoph




> From: fea jabi <zyxrm@hotmail.com>
> To: "user@struts.apache.org" <user@struts.apache.org>, 
> Date: 01.09.2015 14:37
> Subject: RE: Textfield onchange --> handling ajax error response to 
> show action errors
> 
> Can you point me to a link that has the sample which does this 
> please? I tried but couldn't get the result.
> 
> Thanks, for trying to help me on this.
> 
> 
> 
> > From: lukaszlenart@apache.org
> > Date: Sun, 30 Aug 2015 15:22:52 +0200
> > Subject: Re: Textfield onchange --> handling ajax error response 
> to show action errors
> > To: user@struts.apache.org
> > 
> > <s:actionerror/> works on server side but JavaScript works on client
> > side - it isn't possible to join them. You can only mimic its
> > behaviour by adding the same html structure as <s:actionerror/> does.
> > 
> > 2015-08-28 17:14 GMT+02:00 fea jabi <zyxrm@hotmail.com>:
> > >   text-field onchange ---> making ajax call.
> > >
> > >
> > > onsucess ---> everything works fine as needed
> > >
> > >
> > > on failure ----- > like user entered wrong data ---> How to show
> the error messages in jsp. I added fieldError but not sure how to 
> show it in jsp with the ajax stuff.
> > >
> > > In jsp
> > > <s:actionerror/>
> > > ....................
> > >
> > > <script>        ........$.ajax({
> > >
> > >             url: "ajax/retrivexxxAJAXAction.action"+"?
> jsonRequestdata="+JSON.stringify(json),
> > > type: 'POST',
> > > dataType: 'json',
> > >
> > >
> > >             success:function(response){
> > > .......................
> > >  }error:function(jqXhr, textStatus, errorThrown){
> > >
> > >                 alert(textStatus);}
> > >
> > > });
> > > ........
> > >
> > >
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> > 
> 

This Email was scanned by Sophos Anti Virus

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message