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

Edit:

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

http://www.yiiframework.com/wiki/56/reference-model-rules-validation, see "compare".

Duplicate post: http://www.yiiframework.com/forum/index.php?/topic/15976-end-date-grater-than-start-date/

@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

Hi,

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?

Thanks,

Any ideas plzzz?

Thanks,

You need a custom validation function for this.

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

Thanks,

http://www.yiiframework.com/doc/guide/1.1/en/form.model#declaring-validation-rules check how authenticate is implemented.