You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Frost, Gary [IT]" <Ga...@ssmb.com.au> on 2002/12/13 07:08:15 UTC

Help validator requiredif

Ok,

I've been struggling with this for a couple of hours now, tried lots of the
resources online and am struggling to understand those too, hoping someone
can give quickly put me on track.

I've got a form, in that form there is a selector called settleType, the
settleType has several valid values, Standard, Relative and Actual.  The
settleType is required, but the absoluteSettle (another field on that form,
a text box) is only required if settleType = 'Actual'.  I put something like
this in my validator.xml and it generates all the other test fine, but not
the requiredif check.   BTW I'd also like to perform a check on
absoluteSettle to ensure that (if it is required) it is a date, would
putting depends="requiredif, date" (with appropriate date related vars in
place) work?

			<field property="settleType" depends="required">
				<arg0
key="text.tradeentry.date.settleType.label" />
			</field>

			<field property="absoluteSettle"
depends="requiredif" indexedListProperty="dependents">
				<arg0
key="text.tradeentry.date.absoluteSettle.label"/>
				<var>
					<var-name>field[0]</var-name>
	    			<var-value>settleType</var-value>
				</var>
				<var>
	
<var-name>field-indexed[0]</var-name>
					<var-value>true</var-value>
      			</var>
				<var>
		    		<var-name>field-test[0]</var-name>
			    	<var-value>EQUAL</var-value>
				</var>
				<var>
				    <var-name>field-value[0]</var-name>
					<var-value>Actual</var-value>
				</var>
			</field> 


Thanks for any help

Gary

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Help validator requiredif

Posted by James Turner <tu...@blackbear.com>.
> -----Original Message-----
> From: Frost, Gary [IT] [mailto:Gary.Frost@ssmb.com.au] 
> Sent: Friday, December 13, 2002 1:08 AM
> To: 'struts-user@jakarta.apache.org'
> Subject: Help validator requiredif
> 
> 
> Ok,
> 
> the requiredif check.   BTW I'd also like to perform a check on
> absoluteSettle to ensure that (if it is required) it is a 
> date, would putting depends="requiredif, date" (with 
> appropriate date related vars in
> place) work?

Yep.

The thing that strikes me about the code below is that you have
field-indexed set to true.  Are both absoluteSettle and settleType
properties of an indexed field called dependents?  Also, is the value
returned for settleType equal to the string "Actual"?  If so, this
should be working.

James

> 
> 			<field property="settleType" depends="required">
> 				<arg0
> key="text.tradeentry.date.settleType.label" />
> 			</field>
> 
> 			<field property="absoluteSettle"
> depends="requiredif" indexedListProperty="dependents">
> 				<arg0
> key="text.tradeentry.date.absoluteSettle.label"/>
> 				<var>
> 					<var-name>field[0]</var-name>
> 	    			<var-value>settleType</var-value>
> 				</var>
> 				<var>
> 	
> <var-name>field-indexed[0]</var-name>
> 					<var-value>true</var-value>
>       			</var>
> 				<var>
> 		    		<var-name>field-test[0]</var-name>
> 			    	<var-value>EQUAL</var-value>
> 				</var>
> 				<var>
> 				    <var-name>field-value[0]</var-name>
> 					<var-value>Actual</var-value>
> 				</var>
> 			</field> 
> 
> 
> Thanks for any help
> 
> Gary
> 
> --
> To unsubscribe, e-mail:   
> <mailto:struts-user-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <ma...@jakarta.apache.org>
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>