开发者

In Symfony how to set default values to sfWidgetFormDateRange from action

开发者 https://www.devze.com 2022-12-23 00:58 出处:网络
In Symfony how to set default val开发者_如何学Cues to sfWidgetFormDateRange from actionBasically you have to do the following:

In Symfony how to set default val开发者_如何学Cues to sfWidgetFormDateRange from action


Basically you have to do the following:

$form->setDefault('field_name', array('from' => 'yesterday', 'to' => '+10 years'))

These yesterday and +10 years chants actually are anything suitable for strtotime function. Also, you could pass explicit dates without casting any magic:

$form->setDefault('field_name', array('from' => array('month' => 10, 'day' => 12, 'year' => 1984), 'to' => '+10 years'))
0

精彩评论

暂无评论...
验证码 换一张
取 消