struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clayson, Jim" <Jim.Clay...@centrica.co.uk>
Subject help please: Validator basic use
Date Thu, 17 Oct 2002 13:04:56 GMT
Hi I am attempting to use the date validation provided by the framework - I
am using struts1.1b2.

I think I must be missing something fairly fundamental but maybe someone
will be able to confirm what that is. The problem is when I enter garbage
into the form's date fields and submit them, I get no errors. How does one
usually display the errors when using the validator framework.

I have my validator-rules.xml and validation.xml config files in my
application's web-inf dir.

Their relevent contents are as follows:

validator-rules.xml

      <validator name="date"
            classname="org.apache.struts.util.StrutsValidator"
               method="validateDate"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionErrors,
                       javax.servlet.http.HttpServletRequest"
              depends="required"
                  msg="errors.date"
       jsFunctionName="DateValidations">

         <javascript><![CDATA[
            function validateDate(form) {
	....... etc

                return true;
            }]]>
         </javascript>

      </validator>

 and validation.xml:

   <formset>
      <form name="ReportForm">
         <field property="dateFrom" depends="date">
         	     <arg0 key="ReportForm.dateFrom"/>
         </field>    
         <field property="dateTo" depends="date">
         	     <arg0 key="ReportForm.dateTo"/>
         </field>
      </form>
   </formset>   

I have my action's validate attribute set to "true".

Are the above setup correctly?

Thanks
Jim



------------------------------------------------------------
The information contained in or attached to this email is
intended only for the use of the individual or entity to
which it is addressed. If you are not the intended
recipient, or a person responsible for delivering it to the
intended recipient, you are not authorised to and must not
disclose, copy, distribute, or retain this message or any
part of it. It may contain information which is confidential
and/or covered by legal professional or other privilege (or
other rules or laws with similar effect in jurisdictions
outside England and Wales).

The views expressed in this email are not necessarily the
views of Centrica plc, and the company, its directors,
officers or employees make no representation or accept any
liability for its accuracy or completeness unless expressly
stated to the contrary.


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message