Re: Validate date from model

2011-10-24 Thread Andrey Puhalevich
var $validate = array( 'end_date' = array( 'comparison' = array('rule'=array('field_comparison', '', 'start_date'), 'allowEmpty'=true), ), ); function field_comparison($check1, $operator, $field2) { foreach($check1 as $key=$value1) {

Validate date from model

2009-01-14 Thread Mike
Hi everyone, I'm a new user of CakePHP, I tried to do a validation and comparison between 2 dates, a start date and a end date, for calendar events purpose. I want to know how can I do to implement the validation between these 2 dates information just to validate that the end date must be

Re: Validate date from model

2009-01-14 Thread teknoid
You'll need to write a custom function to compare two dates. How to do that is explained in the manual. As far the actual function, there are tons of examples if you search for something like php date compare on google. On Jan 14, 3:56 am, Mike mickael.he...@gmail.com wrote: Hi everyone, I'm

Re: Validate date from model

2009-01-14 Thread fly2279
I'm also new to cake and I just accomplished this myself a few days ago. I only do the start before end validation and not end after start. I don't know if that's a good way to do it or not. In the startBeforeEnd validation you specify which field you want to compare the 'start' field to, in my