Thanks a lot, David for your help.
From: "David Friedman" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
To: "Struts Users Mailing List" <user@struts.apache.org>
Subject: RE: errorStyleClass not working
Date: Fri, 21 Jul 2006 13:16:21 -0400
You should find out what version of the commons validator you are using.
Notes from the Jakarts Commons Validator site shows that older versions may
stop on the first error for INDEXED properties. It sounds like your form
uses and indexed property. See notes like this:
http://mail-archives.apache.org/mod_mbox/struts-user/200508.mbox/%3CE4CD19A7
[EMAIL PROTECTED]
It seems that even the latest greatest stable version of Struts hasn't
upgraded the jakarta commons validator to that high a level so you are
probably best off trying to swap commons-validator.jar files and see if
everything works right with your indexed properties.
I'm out of ideas at this point so good luck (Unles Niall has any ideas).
Regards,
David
-----Original Message-----
From: fea jabi [mailto:[EMAIL PROTECTED]
Sent: Friday, July 21, 2006 9:13 AM
To: user@struts.apache.org
Subject: RE: errorStyleClass not working
I think the problem is on server side.
As in the dispatch aciton, the below statement
org.apache.struts.action.ActionErrors errors = frm.validate( mapping,
request );
is returning just one error even when the 2 entries entered by user are
invalid. only after fixing the first the second error is getting
highlighted.
validation.xml
<formset>
<form name="Form" >
<field property="adHrs" indexedListProperty="hrs"
depends="integer,validwhen">
<msg name="integer" key="lbl.notvalid"/>
<msg name="validwhen" key="lbl.notvalid"/>
<var>
<var-name>test</var-name>
<var-value>(*this* >= 0)</var-value>
</var>
</field>
</form>
</formset>
I tried giving the below plug-in too. But it's the same. only one error
gets
highlighted. What else can I try to make all the errors get highlighted.
Not
sure why the validate is returning one one error when there are 2 entries
that are invalid?
Thanks.
>From: "David Friedman" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
>To: "Struts Users Mailing List" <user@struts.apache.org>
>Subject: RE: errorStyleClass not working
>Date: Thu, 20 Jul 2006 17:23:48 -0400
>
>Is your problem server side or client side? If you problem is client
side
>then you should read the struts javadocs:
>
>http://struts.apache.org/1.2.7/api/org/apache/struts/validator/ValidatorPlu
g
>In.html
>
>Or the User Guides:
>http://struts.apache.org/1.x/faqs/validator.html
>
>Both of them mention a plugin property "stopOnFirstError":
>
><plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> <set-property property="pathnames"
> value="/WEB-INF/validator-rules.xml,/WEB-INF/validations.xml"/>
> <set-property property="stopOnFirstError" value="false"/>
></plug-in>
>
>*****
>Also, if you want to use the errorStyleClass with your validation I think
I
>understand your problem now. At the very bottom of this letter I left in
a
>copy of the code you described using in your dispatch action. You save
>errors with 'saveMessages(request, messages);' which presumably saves
>messages in the Globals.MESSAGE_KEY. If you switch to
'saveErrors(request,
>messages);' then it will save them in the Globals.ERROR_KEY which is used
>by
>the errorStyleClass so it should be able to detect you have an ERROR and
>automatically insert the html for "class='errorMsg'" whenever an error is
>found. For more information see this link where they talk about ERRORS
and
>MESSAGES being saved under different keys, as I've mentioned in my
previous
>posts:
>http://struts.apache.org/1.x/struts-core/apidocs/org/apache/struts/action/A
c
>tion.html
>
>Regards,
>David
>
> >On 7/19/06, fea jabi <[EMAIL PROTECTED]> wrote:
> >>Yah, in the JSP where the errorStyleClass is working I am using
> >><html:errors
> >>property="name"/>
> >>
> >>So, do I have to use html:errors? not html:messages?
> >>
> >>yes, I am using DynaValidatorForm but calling validate from action
>class.
> >>The validation is done in validator.xml
> >>
> >>In dispath action class I have
> >>ActionMessages messages = (ActionMessages)frm.validate( mapping,
request
> >>);
> >> if ( messages != null && !messages.isEmpty() ) {
> >> saveMessages(request, messages);
> >> return (mapping.findForward("validationFailed"));
> >> }
> >>
> >>Should I be saving action errors instead of ActionMessages?
> >>
> >>Thanks.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
_________________________________________________________________
Dont just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfee®
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]