Start date will be smaller than end date

Hi all

I have two date fields and

I want to establish a validation. the validation will Start date always be smaller than enddate


The compare validator may be the best solution for you.

Example --> Creating custom validation rule

Writing your own validator would be one method i think.

Declaring validation rules, see "compare".

Duplicate post:

@mods plz merge together if possible

NOTE: Topics merged

@cool developer - please do not post same question more times (only title where different)…

@mdomba a big sorry

You can extends CValidator like here link here

Thanks to all

I solved the issue with compare validation

thanks buddy

array(‘event_end_date’,‘compare’,‘compareAttribute’=>‘event_start_date’,‘operator’=>’>’, ‘allowEmpty’=>false , ‘message’=>’{attribute} must be greater than “{compareValue}”.’),

you solved my problem ;D


I have a date of birth field in my form. I want to validate only those users who have age greater than 18 considering the months and the date. Any ideas how to go about it?


Any ideas plzzz?


You need a custom validation function for this.

Can u suggest how to go about it? Any examples or code plz.

Thanks, check how authenticate is implemented.