When trying to disable a sfWidgetFormDate widget with $widget->setAttribute('disabled', 'disable'), the class sfWidgetFormDate creates three widgets of type sfWidgetFormSelect but ignores the attribute "disabled".
/**
* @see sfWidgetForm
*/
public function render($name, $value = null, $attributes = array(), $errors = array())
{...
// days
$widget = new sfWidgetFormSelect(array('choices' => $this->getOption('can_be_empty') ? array('' => $emptyValues['day']) + $this->getOption('days') : $this->getOption('days')));
$date['%day%'] = $widget->render($name.'[day]', $value['day']);
// months
$widget = new sfWidgetFormSelect(array('choices' => $this->getOption('can_be_empty') ? array('' => $emptyValues['month']) + $this->getOption('months') : $this->getOption('months')));
$date['%month%'] = $widget->render($name.'[month]', $value['month']);
// years
$widget = new sfWidgetFormSelect(array('choices' => $this->getOption('can_be_empty') ? array('' => $emptyValues['year']) + $this->getOption('years') : $this->getOption('years')), $attributes);
$date['%year%'] = $widget->render($name.'[year]', $value['year']);
return strtr($this->getOption('format'), $date);
}
The array $attributes is never passed to the sfWidgetFormSelect constructor, passing it solves this issue (see attached patch).