You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Asad Habib <as...@gmail.com> on 2008/03/29 06:45:12 UTC

Client Side Validation with Struts

Hello. I am validating data on the client-side using the Javascript
onsubmit event handler and this is working just fine. The problem I am
having is with trying to prevent the action from being called after
the alert window is closed. Is it possible to do this? If so, how?
Also, for client side validation with Struts, do I need to use the
validator? Any help would be appreciated. Thank you.

- Asad

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


Re: Client Side Validation with Struts

Posted by Lukasz Lenart <lu...@googlemail.com>.
>  Hello. I am using Struts 1.3.8. The issue is not one of making the
>  Javascript work (it is working correctly), but rather preventing a
>  Struts action from being called. Is this possible given that the
>  action of a form is a Struts action?

I'm not sure if I understand you, but all you have to do is return
true or false from your JavaScript function (as you doing), and that
will prevent a web browser to submit form and send them to a www
server. And if there be no request from web browser, there be no
action called.
Please copy/paste the web page content you had got when you started your form.


Regards
-- 
Lukasz

http://www.linkedin.com/in/lukaszlenart

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


Re: Client Side Validation with Struts

Posted by Asad Habib <as...@gmail.com>.
Hello. I am using Struts 1.3.8. The issue is not one of making the
Javascript work (it is working correctly), but rather preventing a
Struts action from being called. Is this possible given that the
action of a form is a Struts action?

- Asad



On Sat, Mar 29, 2008 at 6:44 AM, Lukasz Lenart
<lu...@googlemail.com> wrote:
> Hi,
>
>  Could you be more specific, which Struts version? If you use onsubmit
>  event, you should do that like this:
>
>  onsubmit="JavaScript: return validate();"
>
>  where validate() has to return true or false.
>
>
>  Regards
>  --
>  Lukasz
>
>  http://www.linkedin.com/in/lukaszlenart
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Client Side Validation with Struts

Posted by Lukasz Lenart <lu...@googlemail.com>.
Hi,

Could you be more specific, which Struts version? If you use onsubmit
event, you should do that like this:

onsubmit="JavaScript: return validate();"

where validate() has to return true or false.


Regards
-- 
Lukasz

http://www.linkedin.com/in/lukaszlenart

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