fea jabi wrote:
Need to check if the value entered is greater than zero.
Tried the below using the validwhen
<field property="payment" depends="required,validwhen">
<msg name="required" key="error.required"/>
<msg name="validwhen" key="error.gtzero"/>
<var>
<var-name>test</var-name>
<var-value>(*this* > "0.00")</var-value>
</var>
</field>
validation seams to be working right when entered 0,0.00,any string, any
negative number all give validation error. which is exactly what I
wanted. Is this really doing the validation right i.e checking if the
value entered is greater than zero?
Is this the right way to do? or do I have to create the custom validator
to do double value comparision?
Well if what you have is giving you the right behaviour, it doesn't seem
like there's much need to write a custom validation rule :-) That said,
you may want to look at the provided float and double rules and/or the
floatRange and doubleRange rules. See the Validator Guide [1] for details.
L.
[1] http://struts.apache.org/1.2.9/userGuide/dev_validator.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]