try:

public function compareDates()
{
        return ($this->data[$this->alias]['start_date'] <
$this->data[$this->alias]['end_date']) ? true : false;
}

var $validate = array('start_date'=>array('rule'=>'compareDates'));

hth

jon

On 28 July 2010 15:58, Abraham Boray <[email protected]> wrote:
> Hello, Guys
> & get ready 4 the problem
>
> I want to validate 2 dates.
>
> Field           Type
>
> id                      int(11)
> game_name       varchar(255)
> start_date              datetime
> end_date                datetime
> created                 datetime
> modified
>
> In other way I want to validate the start_date against end_date.
>
> End date should be greater that the start_date
> I want the validation to occure in the model !
>
> I've already done something like this, But it's not working!!
>
> 'start_date' => array(
>         'rule' => array('limitDuplicates'),
>            'message' => 'Date départ doit etre inferieure a celle de
> fin !'
>        )
>
> function limitDuplicates($check){
>        //$check will have value of start_date
>
>        return ...;
>    }
>
>
> Thx in advance ;)
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en
>



-- 
jon bennett - www.jben.net - blog.jben.net

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to