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/ValidatorPlug
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/Ac
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]


_________________________________________________________________
Don’t 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]

Reply via email to