One day later, I figured it out. One must split the validators to multiple struts.validator tags, each one having it's own msgkey...

Emmanouil Batsis wrote:


Consider two fields, type and time. The first mandatory, the second dependent on the value of the first.


What I'm trying to do enforce a not null and not empty value for the time field, when the type has a value of 'time'. I've been trying to do this for more than an hour; I was hoping someone can spot my error as i have become really unproductive here :-)

Below I have both my generated validator.xml fragment and my webdoclet tags. Please let me know whats wrong with either!

type field
@struts.validator type="required"  msgkey="error.form.eauction.type"


time field @struts.validator type="minlength" arg1value="${var:minlength}" @struts.validator type="validwhen"

@struts.validator-args arg0resource="error.form.eauction.time"

@struts.validator-var name="minlength"
                      value="1"
@struts.validator-var name="test"
                      value="((type != 'time') or (*this* != null))"


And my XML fragment:


<field property="type" depends="required"> <msg name="required" key="error.form.eauction.type"/>

 <arg0 key="auctionDefinitionForm.type"/>
</field>

<field property="time"
    depends="minlength,validwhen">

 <arg0
   key="error.form.eauction.time"
 />
 <arg1
     name="minlength"
   key="${var:minlength}"
     resource="false"
 />
 <var>
   <var-name>minlength</var-name>
   <var-value>1</var-value>
 </var>

 <var>
   <var-name>test</var-name>
   <var-value>((type != 'time') or (*this* != null))</var-value>
 </var>
</field>

---------------------------------------------------------------------
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]



Reply via email to