struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve" <sms...@neca.com>
Subject 1.1-rc1 and Validator
Date Wed, 19 Mar 2003 14:27:04 GMT
I have just recently begun to utilize the validator in our application
and had I simple question that I could not find an answer to searching
the archives.
I have a search form that a user can enter in 1..n criteria for
searching. In a simple case there are two input fields. The validation
should ensure that at least one of the fields are populated prior to
submitting the form. How would I configure my validation.xml for this
case? I currently have the following:

 <form name="TestSearchForm">
	<field
      	property="someCriteria"
            depends="required,minlength">
            <msg name="required" key="errors.required"/>
            <arg0 key="searchForm.someCriteria"/>
            <arg1 name="minlength" key="${var:minlength}"
resource="false"/>

            <var>
           	  <var-name>minlength</var-name>
              <var-value>5</var-value>
            </var>
      </field>
      <field property="otherCriteria"
                    depends="required">
		<msg name="required" key="errors.required"/>
            <arg0 key="searchForm.otherCriteria"/>
      </field>
 </form>

Which works exactly as you would expect requiring that both fields are
populated. Thanks.


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


Mime
View raw message