I'm using CakePHP 1.3.10 with a MySQL database.
The field event_date has the type "timestamp" in MySQL. The great automagic form element helper gives me a nice dropdown menu.
echo $form->input('event_date');
The problem is, I noted that users could still input invalid, non-existing dates, like the 31st of June.
Okay, I thought ... let's crack out the validation rules. The problem is, the input form puts data in an array([month] => '31', [day] => '06', [year] => '2011', '[hour]' ... et cetera.
The default validation rules only seem to work on strings ... how can I validate in this case? I'd like to stay within the CakePHP framework, I'm still kinda new. I'm just looking for an additional rule to add to my already set 'notempty' rule:
'event_date' => array(
'rule' => 'notEmpty',
'message' => 'Please enter a valid date for this event'
),
I've looked around in the CakePHP documentation, but can't find anything useful. Seems a bit weird that I'd have to go to a lot of trouble to validate the input of an automagically generated form field.