开发者

Validate start date should be less than end date in Yii [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago. 开发者_C百科

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}".'
),
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜