Hi! I’m having the following problem:
In my form theres a datepicker input that has the format dd/mm/yyyy so I added the following rule to the model:
array(‘birth’, ‘match’, ‘pattern’=>’/([0-9]{2}\/[0-9]{2}\/[0-9]{4})/’, ‘message’=>‘Birthday must have the format dd/mm/yyyy’),
But in my database I have a date field, which I must insert with the format yyyy-mm-dd.
So validation fails when I call the save() function of my model after I process the date in the controller to match the mysql date format.
Is there a way I can somehow have different rules for the model and the form?
Thank you in advance.