I would like to hide the "Distance" option on my exposed filter, so all the site visitor sees is the exposed field for Postal code. Is this possible in the UI?
Thanks.

Comments

ankur’s picture

Status: Active » Closed (fixed)

This currently isn't possible through the UI.

It can, however, be done at the code level, using an implementation of hook_form_alter() or hook_form_FORM_ID_alter().

The way to go would probably be to change the '#type' attribute of the 'distance' form element in the exposed filter from 'textfield' to 'hidden' so that it always takes on the default value configured in your exposed filter. You'd probably also want to change the label for the exposed filter to an empty string.

Feel free to re-open if you have any additional questions or to open a separate ticket if you'd like to put in a feature request where this becomes configurable.

jenlampton’s picture

Status: Closed (fixed) » Closed (works as designed)

Yeah, I did a little form_alter jobby on it.
Thanks for the reply :)

joshfromdallas’s picture

Can you post an example of what you did? I am trying to do the same thing and want to alter the Zip code text, and I think this will help. I am trying to understand the hook form alter usuage.