472,354 Members | 1,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

struts javascript validator message problem

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?
Jul 17 '05 #1
5 9641
Alex M wrote:
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.
Jul 17 '05 #2
Peter Astbury wrote:
Alex M wrote:
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.


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

--
Not so interesting...
http://www.mpcontracting.co.uk
Jul 17 '05 #3
"Alex M" <al*@acm.org> wrote in message
news:ac**************************@posting.google.c om...
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.
Jul 17 '05 #4
Hi
I have the same frustrating problem. I fix it with the following
code in validation.xml. Not neat, Strangly,
<arg0 key="error.username.required"/> doesn't work. Probabably
a bug.

<form-validation>
<formset>
<form name="logonForm">
<field property="username" depends="required,maxlength">
<msg name="required" key="error.username.required"/>
<msg name="maxlength" key="error.maxlength"/>
<var>
<var-name>maxlength</var-name>
<var-value>5</var-value>
</var>
</field>
<field property="password" depends="required">
<msg name="required" key="error.password.required"/>
</field>
</form>
</formset>
</form-validation>

<!-- doesn't work

<form-validation>
<formset>
<form name="logonForm">
<field property="username" depends="required">
<arg0 key="error.username.required"/>
</field>
<field property="password" depends="required">
<arg0 key="error.password.required"/>
</field>
</form>
</formset>
</form-validation>

-->
Regards

StrutsMan
Jul 17 '05 #5
Nam
you can use regexp package from apache.org. it is great.

st*******@slingshot.co.nz (strutsman) wrote in message news:<f6**************************@posting.google. com>...
Hi
I have the same frustrating problem. I fix it with the following
code in validation.xml. Not neat, Strangly,
<arg0 key="error.username.required"/> doesn't work. Probabably
a bug.

<form-validation>
<formset>
<form name="logonForm">
<field property="username" depends="required,maxlength">
<msg name="required" key="error.username.required"/>
<msg name="maxlength" key="error.maxlength"/>
<var>
<var-name>maxlength</var-name>
<var-value>5</var-value>
</var>
</field>
<field property="password" depends="required">
<msg name="required" key="error.password.required"/>
</field>
</form>
</formset>
</form-validation>

<!-- doesn't work

<form-validation>
<formset>
<form name="logonForm">
<field property="username" depends="required">
<arg0 key="error.username.required"/>
</field>
<field property="password" depends="required">
<arg0 key="error.password.required"/>
</field>
</form>
</formset>
</form-validation>

-->
Regards

StrutsMan

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: nc | last post by:
My iterator can find my collection when my Action class calls my jsp directly, however when my Action class calls an html file that is set up with IFrames (one of which is loading that same jsp), I...
3
by: sancha | last post by:
Hi, i am in a bit of a delima here. I need to submit an action through javascript so i used document.forms.action='/search.do?&submitaction=Add Minus' document.forms.submit(); since i am...
8
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
1
by: Prasanth Nair | last post by:
hi, When I add the following in struts-config.xml, I am getting the below mentioned error while starting the server. /***********************Struts entry**********************/ <plug-in...
5
by: =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?= | last post by:
Hello, I've been trying to figure something out for the past few days and I can't seem to pinpoint what I'm doing wrong. I've been trying to call javascript from inside a <logic:equal>, but...
1
by: nithiya sri | last post by:
i am new to struts.I try running struts application in Eclipse with the tomcat plug in .. it shows the following error:; please help me in this... SEVERE: Error loading WebappClassLoader ...
2
by: PaulCarmo | last post by:
Hello, I'm validating a form containing various types of data. One of the fields to be validated is an amount which must be between 0.01 and 999999.99. The code for this field validation in the...
8
by: ajos | last post by:
hi frnds, the situation is im developing a web application in struts-- my specifications-eclipse3.2.2,struts1.1,tomcat5.5.23 mysql5.0 db. the scenario-i have a jsp page which adds the...
1
by: NamelessNumberheadMan | last post by:
I can't seem to get Struts 2 validations to work. I have been converting from Strust 1 to Struts 2. So far I've refactored all the code (for this particular module) on the back end, rewrote the jsp...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.