Display values from exposed field in Views as a Dropdown I am building an events website - so I have a taxonomy term Venue - and this, in turn, has a field Address, which is an instance of addressfield.

I need to expose the Locality field of the address to users.  I have this working fine, but it's displaying as a text field, since the original field is a text field.
http://journalofmusic.com/listings/test

I want the field displayed to users as a dropdown of all possible locality fields.

I have taken a look at this thread, and this specific comment:
http://drupal.org/node/1549250#comment-6653514

But I can't quite get it to work.  I've updated the example code to refer to taxonomy_term, and not node, and the locality field...

Below is the code. Can anyone suggest what I'm doing wrong here?

Thanks!

&lt;?php
function dd_locality_form_views_exposed_form_alter(&amp;$form, &amp;$form_state) {
$field_id = 'field_address'; // change for the field in question

// Only alter forms with the necessary field
if (isset($form[$field_id .'_locality'])) {

// Build a query to get all term ids having the specified field
$query = new EntityFieldQuery();
$results = $query-&gt;entityCondition('entity_type', 'taxonomy_term')
-&gt;fieldCondition($field_id, 'locality', '', '!=')
-&gt;fieldOrderBy($field_id, 'locality', 'ASC')
-&gt;execute();

// Attach the field values to the terms
$terms = $results['taxonomy_term'];
field_attach_load('taxonomy_term', $terms, FIELD_LOAD_CURRENT, array('field_id' =&gt; $field_id));

// Add a default so the filter is optional
$options = array('' =&gt; '---');

// Buld the options array based on the query results, overwriting duplicate entries
foreach($terms as $nid =&gt; $term) {
  $value = $node-&gt;{$field_id}['und'][0]['locality'];
  $options[$value] = $value;
}

// Alter the field
$form[$field_id .'_locality']['#type'] = 'select';
$form[$field_id .'_locality']['#options'] = $options;
$form[$field_id .'_locality']['#size'] = 1;
  }
}
?&gt;
There is a small mistake in the code

$value = $node-&gt;{$field_id}['und'][0]['locality'];


should be 

$value = $term-&gt;{$field_id}['und'][0]['locality'];