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(&$form, &$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 input
field in question, the attribute isn't added either:
<input id="edit-mergevars-email" class="form-text required" type="text" maxlength="128" size="25" value="" name="mergevars[EMAIL]">