Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#1 | bef_placeholder_brtamas_integralvision.patch | 2.38 KB | brtamas |
Comments
Comment #1
brtamas CreditAttribution: brtamas commentedHere is a kind of solution. It can be used with the placeholder module (https://www.drupal.org/project/placeholder);
Comment #2
narkoff CreditAttribution: narkoff commentedThanks 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.
Comment #3
Neslee Canil PintoHi, 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).