To get the date picker on the new registration form, I had to include javascripts
in the indexSuccess template of my form (my fault)
as for the year range, I modified the plugin file to include additional parameter
class sfWidgetFormDateJQueryUI extends sfWidgetForm
{
protected function configure($options = array(), $attributes = array())
{
if(sfContext::hasInstance())
$this->addOption('culture', sfContext::getInstance()->getUser()->getCulture());
else
$this->addOption('culture', "en");
$this->addOption('change_month', false);
$this->addOption('change_year', false);
$this->addOption('number_of_months', 1);
$this->addOption('show_button_panel', false);
$this->addOption('theme', '/sfJQueryUIPlugin/css/ui-lightness/jquery-ui.css');
$this->addOption('year_range', '-30:+0');
parent::configure($options, $attributes);
}
public function render($name, $value = null, $attributes = array(), $errors = array())
{
$attributes = $this->getAttributes();
$input = new sfWidgetFormInput(array(), $attributes);
$html = $input->render($name, $value);
$id = $input->generateId($name);
$culture = $this->getOption('culture');
$cm = $this->getOption("change_month") ? "true" : "false";
$cy = $this->getOption("change_year") ? "true" : "false";
$nom = $this->getOption("number_of_months");
$sbp = $this->getOption("show_button_panel") ? "true" : "false";
$yrs = $this->getOption("year_range");
if ($culture!='en')
{
$html .= <<<EOHTML
<script type="text/javascript">
$(function() {
var params = $.datepicker.regional['$culture'];
params.changeMonth = $cm;
params.changeYear = $cy;
params.numberOfMonths = $nom;
params.showButtonPanel = $sbp;
params.yearRange = "$yrs";
$("#$id").datepicker(params);
});
</script>
EOHTML;
}
else
{
$html .= <<<EOHTML
<script type="text/javascript">
$(function() {
var params = {
changeMonth : $cm,
changeYear : $cy,
numberOfMonths : $nom,
showButtonPanel : $sbp,
yearRange : "$yrs"
};
$("#$id").datepicker(params);
});
</script>
EOHTML;
}
return $html;
}
public function getStylesheets()
{...
}
public function getJavaScripts()
{...
}
}
and setup the widget as:
$this->widgetSchema['date_of_birth']= new sfWidgetFormDateJQueryUI(array("change_month" => true, "change_year" => true, "theme" => "smoothness/jquery-ui-1.8.custom.css", "year_range" => "-30:+0"));