Mimic webform date field in custom form In one instance we are using a webform to create a form and it uses field type 'date'. The end result looks like this:



I would like to mimic this, but in a custom form. Currently what I have is:


Code:

 $form['date_starting'] = array(
  '#type' =&gt; 'date_select',
  '#title' =&gt; t('Starting'),
  '#date_label_position' =&gt; 'within',
  '#date_format' =&gt; 'm d Y',
  );
If you have date_popup enabled you can achieve the calendar part by using this:

$form['date_starting'] = array(
  '#type' =&gt; 'date_popup',
  '#title' =&gt; t('Starting'),
  '#date_format' =&gt; 'Y-m-d',
  '#date_year_range' =&gt; '-3:+3',
);


Then you can style the input field as a calendar button and use javascript to copy the date value to your date select.