using dbFormExtraPlugin for datepicker or datetimepicker

Posted by Gijs Nelissen in All, Programming

For an internal web development project i was looking for a good date picker. I bounced onto sfFormExtraPlugin, but it took me a while to find the correct jquery & jquery UI css & javascript files and set the paths. I decided to create my owner datepicker based on the one in sfFormExtraPlugin (which was based on the jQuery UI Datepicker).

As we already had a plugin containing some of the widgets/validators we are using for some of our webdesign projects, i decided to include those widgets into the existing one named dbFormExtraPlugin, original name, i know…

Installing dbFormExtraPlugin

It’s really this simple, install, publish assets, en clear your cache.

symfony plugin:install dbFormExtraPlugin --release=0.0.5
symfony plugin:publish-assets
symfony cache:clear

sfWidgetFormDateJQuery

This is based on the normal jQuery date picker

class ProjectForm extends BaseProjectForm
{
  public function configure()
  {
 
      $this->widgetSchema['published_at'] = new sfWidgetFormDateJQuery();
  }
}

Should give you something like this

sfwidgetformdatejquery

sfWidgetFormDateTimeDyn

This is based on the dyndatetime project, something i found on google code. From their website :

jQuery has lots of date pickers, but no date- time pickers. This supports date and time, and renders the value to a single field in a configurable format.

Use it like this

class ProjectForm extends BaseProjectForm
{
  public function configure()
  {
      $this->widgetSchema['featured_at'] = new sfWidgetFormDateTimeDyn();
  }
}

Results in a popup, similar to the dynarch calendar picker, including time sliding capabilities !

sfwidgetformdatetimedyn

I still have some work todo on configuration/customisation but it does work (out of the box).
Other installation instructions here. Comments welcome. Leave a message on this post, post a bugticket on the symfony trac or contact us by email.

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

6 Responses

May 29, 2009
ali hichem

great !!!
thank you very much ;) !


September 8, 2009
tentamen

i want display datetime in format %d/%m/%Y-%H:%M
i change ifFormat, but when save it’get error

how to change format display, thanks :)


September 8, 2009
gino pilotino

how did you get a text input for date ? (instead of the three selects)


September 22, 2009
youhean

hi i do it the following, but it work only for backend. At the fontend it donesn’t show the button date picker. any ideal? please help


September 27, 2009

How i Change the language? Its en in default, dont find where can i config! :(


September 13, 2010
Petronel

There are no images on this page: http://www.digitalbase.eu/blog/using-dbformextraplugin-for-datepicker-or-datetimepicker/

Please review your web page as it looks interesting !

With kind regards

Petronel