struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Mistroni" <mmistr...@waersystems.com>
Subject Problem with struts validator
Date Wed, 07 Apr 2004 15:31:13 GMT
Hi all,
	I am experiencing problems with struts-validator, in that it
seems
That the validation is not done at all.
I have created a form (named contactFomr) that extends
DynaValidatorForm.

<form-bean name="contactForm"
type="org.apache.struts.validator.DynaValidatorForm">		
			 <form-property name="contactRef"
type="java.lang.String"/>
		     <form-property name="contactName"
type="java.lang.String"/>
		     <form-property name="address1"
type="java.lang.String"/>
		     <form-property name="address2"
type="java.lang.String"/>
		     <form-property name="address3"
type="java.lang.String"/>
		     <form-property name="address4"
type="java.lang.String"/>
		     <form-property name="postcode"
type="java.lang.String"/>
		     <form-property name="fax" type="java.lang.String"/>
		     <form-property name="country"
type="java.lang.String"/>
		     <form-property name="emailAddress"
type="java.lang.String"/>
		     <form-property name="website"
type="java.lang.String"/>
		     <form-property name="telephohe"
type="java.lang.String"/>
		     <form-property name="version"
type="java.lang.Integer"/>
		     <form-property name="versionDate"
type="java.sql.Timestamp"/>
		     <form-property name="buttonSelected"
type="java.lang.String"/>
		     <form-property name="statusMessage"
type="java.lang.String"/>
		</form-bean>


I have created a validation.xml file which contains following code

<form-validation>


    <!-- ========== Default Language Form Definitions
===================== -->
    <formset>
       
       <!-- Validation rules for Contact form. We need to check
            only that contactRef is present
       -->
        <form name="contactForm">

            <field property="contactRef"
                    depends="required,minlength">
                  <var>
                    <var-name>minlength</var-name>
                    <var-value>5</var-value>
                  </var>  
                
                <!--   
                <msg 
                	name="required"
                	key="message.00042"/>-->
            </field>

            
        </form>

    </formset>


</form-validation>


I have configured the plugIn In struts-config.xml ,  but whenever I
submit the form (not providing the field contactRef) everything is fine
and the form is submitted (while I was expecting to receive an error
displayed on my
Input page..)

Anyone can help?

Thanx in advance and regards
	marco







-----Original Message-----
From: Zakaria khabot [mailto:z.khabot@ced.mfie.gov.ma] 
Sent: 07 April 2004 11:56
To: Struts Users Mailing List; Struts Developers List
Subject: validation.xml

Hi all,

How to call the validator from an Action.
- in struts-config I put validate="false",
- I am using validation.xml to control erors.
- In the action I wrote :            
ActionErrors errors = new ActionErrors();

errors = form.validate(mapping, request);

but it executes the validate methode in the formAction not in the
validation.xml.



Thanks for help... 




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


Mime
View raw message