Drupal 6 Forms date_select element

Following is the right way to define a form element based on day/month/year selectors in Drupal 6. The ‘date_select’ element is brought by the Date API module.

   
    $format = 'd/m/Y';

    $form['date_of_birth'] = array(
        '#type' => 'date_select',.
        '#title' => t('Date of birth'),
        '#default_value' => date($format, time()),
        '#date_format' => $format,
        '#date_label_position' => 'within', // Other options in date_api_elements.inc
        '#date_timezone' => 'Europe/Madrid', 
        '#date_increment' => 15, .
        '#date_year_range' => '-80:0',
        '#prefix' =>'<div class="prefix">',
        '#suffix' => '</div>',
    );
Advertisements

2 thoughts on “Drupal 6 Forms date_select element

  1. It’s hard to find your posts in google. I found it on 11 spot, you should build
    quality backlinks , it will help you to increase traffic. I know how to help
    you, just type in google – k2 seo tips

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s