struts javascript validator message problem

A

Alex M

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

Peter Astbury

Alex said:
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?

javascript? This is the java newsgroup - try posting that to
comp.lang.javascript instead.
 
M

Matt Parker

Peter said:
javascript? This is the java newsgroup - try posting that to
comp.lang.javascript instead.

He is right to post here, this is a Struts question. As it is, I don't know
the answer since I've only used the server-side validator component, not
the client-side component. Maybe someone else will have an idea.

OS, browser etc would be some useful information...

Matt
 
R

Ryan Stewart

Alex M said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,743
Latest member
WoodrowMea

Latest Threads

Top