I've got some problem with symfony form value (i guess it's the clean value, but not so clear yet). Here's the problem :
I got a sfFormDateJQueryUI widget setup like this in my form :
$this->setWidgets(array(
'needDate' => new sfWidgetFormDateJQueryUI(),
));
$this->setValidators(array(
'needDate' => new sfValidatorDate(array(
'required' => true,
'date_format' => '/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/',
'date_output' => 'd/m/Y'
)),
));
Then when i submit, say 26/06/2010, it turns out right in the HTTP Header (viewed via Firebug) and $request (i just print it). But after i get the value via
$formVal = $form->getValues();
the date value in $formVal["needDate"]
become today's date (03/06/2010). I really don't understand, and after che开发者_StackOverflow社区cking in the API documentation it says that the getValues will return the 'cleaned' value. Is that because of it ? I don't understand what's 'clean'.
Thanks before..
Somehow I solved the problem. It turns out that the value can't validate, so when I changed the validator to:
'needDate' => new sfValidatorRegex(array(
'pattern' => '/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/'
))
everything works fine.
精彩评论