Re: DB_DO_FormBuilder - date field as a jscalendar!
| From: | Anselm Heaton | Date: | Tue, 31 Jan 2006 22:18:19 +0000 |
| Subject: | Re: DB_DO_FormBuilder - date field as a jscalendar! | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-22737@lists.php.net to get a copy of this message | ||
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');
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.
Anselm
--
------------------------------
Netuxo Ltd
a workers' co-operative
providing low-cost IT solutions
for peace, environmental and social justice groups
and the radical NGO sector
Registered as a company in England and Wales. No 4798478
Registered office: 5 Caledonian Road, London N1 9DY, Britain
------------------------------
email office@netuxo.co.uk
http://www.netuxo.co.uk
------------------------------