My table has (among other columns) a start date and end date. I need to validate that the start date is less than the end date in Yii.
Do I validate that?
Use the CCompareValidator for comparison validation in the rules() method of your model:
array(
'event_end_date',
'compare',
'compareAttribute'=>'event_start_date',
'operator'=>'>',
'allowEmpty'=>false ,
'message'=>'{attribute} must be greater than "{compareValue}".'
),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With