I'm using a node reference field as an exposed filter in views.

functionally it works fine. but the display has extra html. see screenshot.

any idea how to clean this up?

thanks !

CommentFileSizeAuthor
exposed.png17.41 KB_paul_meta
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fatima’s picture

Were you able to find a solution? I'm running into the same issue.

_paul_meta’s picture

At the moment i'm relying on some jquery to clean up the output - not the best way but its working as a hacky fix

jQuery("select#my-menu option").each(function() {
var str = jQuery(this).text( jQuery(this).text().replace('<span class="views-field views-field-title"> <span class="field-content">','').replace('</span> </span>','') );
jQuery(this).text(str);
});
meladawy’s picture

The same issue here !

JordiTR’s picture

Hi you all.

I don't know if we should consider that issue buggy. I realized that if I enter on "Style options" on the title field and I active all "Customize field HTML", "Customize label HTML" and "Customize field and label wrapper HTML" and I choose on all of them "- none -", then there is no HTML taggin. Then my exposed filter select output was clean, just the node title, no spans at all.

It's quite an old issue but if someone is subscribed maybe could check if that solves the problem instead of hacking code :-)

rob3000’s picture

I've just had this similar issue and created a hook_form_alter to override the field.

function HOOK_form_alter(&$form, &$form_state, $form_id) {
  if($form_id ==  'views_exposed_form' && $form['#id'] == 'views-exposed-form-home-finder-page-3'
    || $form['#id'] == 'views-exposed-form-home-finder-page'
    || $form['#id'] == 'views-exposed-form-home-finder-page-1') {


    $form['field_company_reference_target_id']['#options'][458] = 'some text';

  }
}
DaneMacaulay’s picture

remove html tags in the field settings

idcm’s picture

oops. posted in wrong place