473,732 Members | 2,227 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
ApplicationReso urces.propertie s 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 9722
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
ApplicationReso urces.propertie s 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.javas cript 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
ApplicationReso urces.propertie s 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.javas cript 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.goo gle.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
ApplicationReso urces.propertie s 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:javascrip t>
tag in the file where you want to do the validation as well as a script tag
to include an external js file, staticJavascrip t.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="retur n validateLogonFo rm(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.user name.required"/> doesn't work. Probabably
a bug.

<form-validation>
<formset>
<form name="logonForm ">
<field property="usern ame" depends="requir ed,maxlength">
<msg name="required" key="error.user name.required"/>
<msg name="maxlength " key="error.maxl ength"/>
<var>
<var-name>maxlength</var-name>
<var-value>5</var-value>
</var>
</field>
<field property="passw ord" depends="requir ed">
<msg name="required" key="error.pass word.required"/>
</field>
</form>
</formset>
</form-validation>

<!-- doesn't work

<form-validation>
<formset>
<form name="logonForm ">
<field property="usern ame" depends="requir ed">
<arg0 key="error.user name.required"/>
</field>
<field property="passw ord" depends="requir ed">
<arg0 key="error.pass word.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*******@sling shot.co.nz (strutsman) wrote in message news:<f6******* *************** ****@posting.go ogle.com>...
Hi
I have the same frustrating problem. I fix it with the following
code in validation.xml. Not neat, Strangly,
<arg0 key="error.user name.required"/> doesn't work. Probabably
a bug.

<form-validation>
<formset>
<form name="logonForm ">
<field property="usern ame" depends="requir ed,maxlength">
<msg name="required" key="error.user name.required"/>
<msg name="maxlength " key="error.maxl ength"/>
<var>
<var-name>maxlength</var-name>
<var-value>5</var-value>
</var>
</field>
<field property="passw ord" depends="requir ed">
<msg name="required" key="error.pass word.required"/>
</field>
</form>
</formset>
</form-validation>

<!-- doesn't work

<form-validation>
<formset>
<form name="logonForm ">
<field property="usern ame" depends="requir ed">
<arg0 key="error.user name.required"/>
</field>
<field property="passw ord" depends="requir ed">
<arg0 key="error.pass word.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
10303
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 get a servlet error "cannot find collection". Not usre if my issue is HTML, JSP, WebSphere or ??? Any help is very much appreciated. HTML file: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
3
10267
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 working on struts then submitaction maps to through the
8
3674
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
1
1850
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 className="org.apache.struts.validator.ValidatorPlugIn"> <set-property property="pathnames" value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml"/>
5
20007
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 it doesn't seem to work like I want. I've tried calling an alert('hello'); to test out if my call worked correctly, and it does, but when I call my own javascript functions
1
2792
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 delegate: false repositories:
2
1366
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 validation.xml is; <field property="amount" depends="required,webxvalidator,floatRange"> <arg0 key="label.authorization.txn.amount"/> <arg1 name="floatRange" key="${var:min}" resource="false"/>
8
12769
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 records in the db.when the user clicks submit,a javascript gets fired and checks the validation.on submit the BdgMastAction.java does all the data access and forwards the control to a jsp named bdgm.jsp.the results are displayed in the jsp.the values...
1
11531
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 using Struts 2 notations, and wired up the xml (aside from the abc-validation.xml). Everything runs just fine. If there is an error not generated by user input (i.e. file format problem) I can get that message to come out, so I know my error messages...
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8774
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9447
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9307
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9181
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.