Using hook_form_alter to enter placeholder in mailchimp signup fom For the signup form I'm using the Mailchimp Signup module. The idea is to hide the label, which I did using the unset(); function, and put an a placeholder in the input field where people enter their emailaddress.

Here's the code: 

function bw_custom_form_alter(&amp;$form, &amp;$form_state, $form_id){

  if ($form_id == 'mailchimp_signup_subscribe_block_mysite_group_form') {
    //dpm($form);
    unset( $form['mergevars']['EMAIL']['#title']);
    $form['mergevars']['EMAIL']['#placeholder'] = t('Your emailaddress');
    dpm($form['mergevars']['EMAIL']['#placeholder']);
    }
}


dpm($form['mergevars']['EMAIL']['#placeholder']); returns the string Your emailaddress nicely in the green drupal message frame. Yet, the actual placeholder isn't there in my input element. Looking at the attributes of the particular inputfield in question, the attribute isn't added either:

&lt;input id="edit-mergevars-email" class="form-text required" type="text" maxlength="128" size="25" value="" name="mergevars[EMAIL]"&gt;
You have to use this:

$form['mergevars']['EMAIL']['#attributes'] = array(
 'placeholder'=&gt; t('Your placeholder'),
);