to validate dates during user registration. I'm using the form helper
to generate the day, month, and year select boxes:
echo $form->input("birthday", array(
"label" => "Birthday",
"maxYear" => date("Y"),
"minYear" => 1900,
"separator" => " ",
"type" => "date"
), false
);
In my model, I have this validation rule (among others):
"birthday" => array(
"allowEmpty" => false,
"message" => "Please enter a valid date",
"required" => true,
"rule" => array("date", "mdy"),
)
However, I get two errors from this. Even when a valid date is
submitted, "Please enter a valid date" appears below the field. I also
get a warning: preg_match() expects parameter 2 to be string, array
given [CORE/cake/libs/validation.php, line 847]. I have a feeling that
this is because the date is supposed to validate a string, not an
array of strings. I know I can validate each select individually, but
I was wondering if there was a function that did this. It seems to me
that if the default for date columns is three select boxes, the
default for date validation should also be three select boxes.
I apologize if this has already been asked, and thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment