Re: DB_DO_FormBuilder - date field as a jscalendar!
| From: | Phillip Novess | Date: | Mon, 30 Jan 2006 17:25:48 +0000 |
| Subject: | Re: DB_DO_FormBuilder - date field as a jscalendar! | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-22732@lists.php.net to get a copy of this message | ||
Hugo,
I had to hack together a quickform element. This is based on the autocomplete element that comes with Quickfom and the calendar.php code that comes with jscalendar. I sort of combined them into a new custom element for Quickform. The element and an example are included in a tar below.
Attachment: [application/x-gzip] example.tgz
You have to add the custom element to your instance of Quick form by adding to this array:$GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'] =
array(
// default elements are listed here
'jscalendar' =>array('HTML/QuickForm/jscalendar.php','HTML_QuickForm_jscalendar'),
);
That array registers all of the elements. It's located in the pear directory within HTML/QuickForm.php file.
Then you move the attached jscalendar.php file into the subdirectory for Quickform elements - HTML/QuickForm/.
Next you have to manually include the jscalendar files in your template or by echoing them. I couldn't figure out how to call a method that would return these files. TO GROUP: any suggestions?
Within your form create a jscalendar element. There is also an example.php file that demonstrates.If you want to add this to a date element within FormBuilder just do the same things except create elements in the preGenerateForm callback. TO GROUP: this is a hack It does not conform to PEAR guidelines and has not been tested except by me. I also have not figured out how to export the include files and such for inclusion in your page. If anybody would like to extend this or modify it to be PEARish by all means please do so. Thanks, phill
Attachment: [application/x-gzip] example.tgz