I have a Views exposed filter where I have added a placeholder value in the textfield for the exposed filter. However, this placeholder value disappears when I enable BEF secondary exposed form option. My form ID seems to be the same. What needs to change in the hook_form_alter in order to work in the secondary form?

The placeholder value is added in my template.php file as:

function MY_THEME_form_alter(&$form, &$form_state, $form_id) {
   // target exposed filter form
  if ($form_id == 'views_exposed_form') {
    // HTML5 placeholder attribute
    $form['landmark']['#attributes']['placeholder'] = t('Landmark');
  }
}

Thank you.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

brtamas’s picture

Here is a kind of solution. It can be used with the placeholder module (https://www.drupal.org/project/placeholder);

narkoff’s picture

Thanks for the patch. Right now, I don't have the requirement to use a BEF secondary filter anymore. But hopefully this helps someone or perhaps myself in the future.

Neslee Canil Pinto’s picture

Status: Active » Closed (won't fix)

Hi, there will be no more future development for 7.x branch. If you see this issue in 8.x, feel free to file an issue. Closing this as Closed(wont fix).