compare
: CCompareValidator, compares the specified attribute value with another value and validates if they are equal.allowEmpty
, whether the attribute value can be null or empty.compareAttribute
, the name of the attribute to be compared with.compareValue
, the constant value to be compared with.operator
, the operator for comparison.strict
, whether the comparison is strict (both value and type must be the same.
And to use this just see the example below to rules() in your model..
array( 'start_time_planned', 'compare', 'compareAttribute'=>'end_time_planned', 'operator'=>'<=', 'allowEmpty'=>false , 'message'=>'{attribute} must be greater than "{compareValue}".' ),the operator can be =,<,>. and you can have a custom message for error in "message" property
nice post.. it helps me a lot because i was hunting around without caching any animal.. cool..
ReplyDelete