I have just uploaded a patch for the Date Popup module which allows dates to be allowed and disallowed in the popup calendar.
You can find it here.
This was a critical issue for the current commercial project I'm working on, and after having my knuckles wrapped by KarenS for complaining and not helping - I helped.
Showing posts with label date. Show all posts
Showing posts with label date. Show all posts
Wednesday, 16 February 2011
Wednesday, 2 February 2011
Your very own date field
So here's the problem: you have your own hand-built form and you want to include a date field.
The difficulty that I keep running into with Drupal 7 is that everything is tailored around entities - the whole (amazing) Field API - requires an entity to operate on.
But I just want a configuration page with a date field (or in my case a whole bunch of date fields).
Well I have researched long and hard and come up with something very very easy:
$form['date'] = array(
'#type' => 'date_popup',
);
Which will do it all for you. Watch out for the help text that says it should be "date-popup" because that's wrong. Your default date should be in the form "YYYY-MM-DD HH:MM:SS", you can also set timezones and lots of other useful stuff.
Find the date_popup.module file and search for "date_popup_element_info". It gives you all the defaults for this element type.
The difficulty that I keep running into with Drupal 7 is that everything is tailored around entities - the whole (amazing) Field API - requires an entity to operate on.
But I just want a configuration page with a date field (or in my case a whole bunch of date fields).
Well I have researched long and hard and come up with something very very easy:
$form['date'] = array(
'#type' => 'date_popup',
);
Which will do it all for you. Watch out for the help text that says it should be "date-popup" because that's wrong. Your default date should be in the form "YYYY-MM-DD HH:MM:SS", you can also set timezones and lots of other useful stuff.
Find the date_popup.module file and search for "date_popup_element_info". It gives you all the defaults for this element type.
Subscribe to:
Posts (Atom)