Greetings,
In my view I have a date input, set like so:
echo $form->input('cc_expdate', array('label' => __('exp. date', true),
'type' => 'date', 'dateFormat' => 'MY', 'default' => date('Y'),
'minYear' => date('Y'), 'maxYear' => date('Y', strtotime("+10 years")),
'orderYear' => 'asc', 'separator' => ' ', 'monthNames' => false));
And in my model I have a validation rule, viz:
'cc_expdate' => array(
'rule' => array('date', 'my'),
'message' => 'Please select a valid expiration date'
)
But the validation always fails. When I look at $this->data
, I see that the date is being passed through the form as an array (e.g. 'cc_expdate' => array('month' => '10', 'year' => '2010')
) but it seems the date validation rule expects a string like 10-2010
. I hunted around Cake and checked the documentation but could find nothing covering this. It seems this should be a simple task to handle, am I missing something simple or does Cake not have a built in validation for 'date' form elements?
cheers,
-Bri