- Drupal CMS Developer
- Website speed optimisation
- Drupal 6 to Drupal 8 migrations
Using date popup fields from the date module
I found it hard to find information on how to implement a date field in your forms using the form API. I actually wanted a date popup field. Below is the code for using it
$form['dob'] = array(
'#type' => 'date_popup',
'#title' => t('DOB'),
'#date_format' => 'Y-m-d',
'#date_year_range' => '-100:+0',
);
You can also find more options here http://drupal.org/node/292667
- Scripts:
Comments
Thanks! I have been looking
Thanks! I have been looking for this all over.
Me, too!
Me, too! Thanks for this!