Re: DB_DO_FormBuilder - date field as a jscalendar!

From: Date: Tue, 31 Jan 2006 22:43:25 +0000
Subject: Re: DB_DO_FormBuilder - date field as a jscalendar!
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22738@lists.php.net to get a copy of this message
On 1/31/06, Anselm Heaton <anselm@netuxo.co.uk> wrote: > Hugo wrote : > >> How I make my form date field as a jscalendar using > >> DB_DataObject_FormBuilder? > > Philip wrote : > > I had to hack together a quickform element. > > Another way to do this is to use unobstrusive javascript. The idea being that > you create a normal input, and javascript comes behind the scenes to add the > datapicker - it means your form logic is free from your widget logic. > > You can find a nice datepicker that does this here : > > http://www.frequency-decoder.com/2005/10/14/unobtrusive-date-picker-widgit/ > > With FormBuilder and the mentioned date picker, you could add the following to > your DB_DataObject : > > $fb_elementTypeAttribute = array('date' => array('class' => > 'format-d-m-y')); > $fb_elementTypeMap = array('date' => 'HTML_QuickForm_Text'); > That should be. $fb_elementTypeMap = array('date' => 'text'); > And include the datepicker javascript in your html file. I haven't tested this > yet (I am planning too!) so there might be some unexpected problems (let us > know if there are!) but otherwise, it should just work this way. > -- Justin Patrin

« previous php.pear.general (#22738) next »