Is it possible to have placeholder text on a view filter with type date_text? I've got an exposed filter on my view that allows users to specify a date, and I want to specify a placeholder for this text field.

I've tried doing this using the following code in a hook:

$form['field_start_end_dates_value']['value']['#attributes'] = array('placeholder' =&gt; array(t('Search')));


(I know this is in the correct hook as I'm successfully altering other form elements within the same form)

I've var_dumped the form variable, and I'm getting the following output for the date filter:

[field_start_end_dates_value] =&gt; Array
        (
            [#tree] =&gt; 1
            [value] =&gt; Array
                (
                    [#title] =&gt; 
                    [#type] =&gt; date_text
                    [#size] =&gt; 20
                    [#default_value] =&gt; 
                    [#date_format] =&gt; j M Y
                    [#date_label_position] =&gt; within
                    [#date_year_range] =&gt; -3:+3
                    [#process] =&gt; Array
                        (
                            [0] =&gt; date_text_element_process
                        )

                    [#prefix] =&gt; 
                    [#suffix] =&gt; 
                    [#attributes] =&gt; Array
                        (
                            [placeholder] =&gt; Array
                                (
                                    [0] =&gt; Specify Date
                                )

                        )

                )

        )


This looks right to me, but I'm not seeing the placeholder on the front end.

I've tried flushing the cache multiple times, and loading the page without JavaScript enabled.

What am I doing wrong?
You are doing it wrong way

Form alter doesn't work here.
This is how it can be achieved:

It depends on which date element you are using
There are few hooks available

hook_date_text_process_alter()
hook_date_popup_process_alter()
hook_date_combo_process_alter()
hook_date_select_process_alter()


I am showing for hook_date_text_process_alter()

/**
 * Implements hook_date_text_process_alter().
 */
function MYMODULE_date_text_process_alter(&amp;$element, &amp;$form_state, $context) {
  if ($form_state['complete form']['#form_id'] == 'views_exposed_form') {
    //dpm($form_state);
    if ($element['#id'] == 'edit-field-appintment-date-value-value') {
      $element['date']['#attributes']['placeholder'] = t('Demo placeholder');
      //dpm($element);
    }
  }
}


For Other text elements
Below is the correct example of adding a placeholder to views_exposed_form to any other text field but date field can't be done like this.

/**
 * Implements hook_form_views_exposed_form_alter().
 */
function MYMODULE_form_views_exposed_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  $form['title']['#attributes'] = array('placeholder' =&gt; array(t('Your Placeholder')));
}


Hope this helps