I have a form where a user can select a city from a dropdown list. I've set this up as a custom field filter. When a city is selected there is some JavaScript populating a hidden distance:from field behind the scenes. At the foot of the form is a distance:radius field.

Is there a way to ignore the city field if distance:radius exists? The idea being that the user wants to see the results within the radius, regardless of whether the result is in the city. If no radius is selected the results should be based on the city field.

// Search form
{exp:low_search:form query='{segment_3}'}

    <select name="search:city">
        <option value=""{if low_search_search:city == ''} disabled selected{/if}>
            Select a city
        <option value="City 1"{if low_search_search:city == 'City 1'} selected{/if}>
            City 1
        <option value="City 2"{if low_search_search:city == 'City 2'} selected{/if}>
            City 2
        <option value="City 3"{if low_search_search:city == 'City 3'} selected{/if}>
            City 3

    <select name="distance:radius">
        <option value=""{if low_search_distance:radius == ''} disabled selected{/if}>Select distance</option>

        {exp:low_list:each items="5|10|20|30|50" as="distance"}
        <option value="{distance}"{if distance == low_search_distance:radius} selected{/if}>
            {distance} miles


    <input type="hidden" name="distance:from" {if low_search_distance:from}value="{low_search_distance:from}"{/if} id="coord-field">    


// Results
{exp:low_search:results query='{segment_3}' limit='12' distance:to='cf_lat|cf_lng' distance:unit='mi'}

    ... Results


Is this at all possible? Thanks in advance.

1 Answer 1


Not natively with Low Search itself, but since you're already using JavaScript, you could create a function that would disable or clear the City select element when a radius is selected. Adding a disabled property to a form input/select element will not send that field when the form is submitted.

  • That'll work perfectly for me. Thanks for the help. Oct 7, 2016 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.