Re: struts javascript validator message problem
From: Ryan Stewart (zzanNOtozz_at_gSPAMo.com)
Date: 02/24/04
- Next message: Andrew Thompson: "Re: Internet Explorer/java applet wont print color"
- Previous message: Andrew Thompson: "Re: Background Graphics"
- In reply to: Alex M: "struts javascript validator message problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 24 Feb 2004 06:53:58 -0600
"Alex M" <alx@acm.org> wrote in message
news:ac45876e.0402231157.7499f7d5@posting.google.com...
> I'm trying to use the jakarta struts client side javascript validators
> and the validators are working, but they are not showing the popup
> messages. I have the message keys defined in the
> ApplicationResources.properties file, the propertise file is in the
> right location, it is referenced from the struts-config.xml, but still
> no messages. For example, submitting a form that violates the
> required field validator, just causes it to do nothing but shift focus
> to that field, no messages are shown.
>
> Am I missing something?
Do you have all the javascript elements and files in the proper places? I'm
learning Struts now and just tinkered with that feature yesterday. If you
look at the example application that comes with it, you'll see an example of
Javascript validation in their logon.jsp. First of all, the Javascript
itself is specified in validator-rules.xml. You need an <html:javascript>
tag in the file where you want to do the validation as well as a script tag
to include an external js file, staticJavascript.jsp (that's their name for
it). See the example app for this file's contents (it's tiny, not sure how
it does what it does yet). Finally, in the form you want to validate add to
the form tag:
onsubmit="return validateLogonForm(this);"
Or whatever function you want to call. I think that's everything.
- Next message: Andrew Thompson: "Re: Internet Explorer/java applet wont print color"
- Previous message: Andrew Thompson: "Re: Background Graphics"
- In reply to: Alex M: "struts javascript validator message problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|