Quick Tip: using format option with sfWidgetFormJqueryDate

It is not well documented how to use the format option for sfWidgetFormJQueryDate in the sfFormExtrasPlugin for Symfony 1.4.

However, once I learned about sfWidgetFormJQueryDate’s date_widget option it was pretty easy.  Just create a new date widget and use the format option there.

The example below needs to be in your form’s configure method and assumes our field is named “available”.  The format I chose gets rid of the forward slashes between the selects that were showing up to the right of the button that triggers the calendar input.  I’m also setting the button text.

new sfWidgetFormJQueryDate(
'config' => '{buttonText: "Choose Date"}',
'date_widget' => new sfWidgetFormDate(array('format'=>'%month%%day%%year%'))

hopefully this will make googling this little issue a little easier.