I created a custom module to override some fields in an exposed form created by views. One of the filters is the between filter on a number field. The between filter produces min and max fields for every field in the form. What I want to do is replace the min and max text fields with lists of integers that the user can select from. Where I am stuck at is the default value of the lists. I keep getting the following message: "An illegal choice has been detected. Please contact the site administrator." Below is a snippet from my module file:


          '#type' => 'select',
          '#options' => $sale_price_min_options,
          '#default_value' => "",
                '#type' => 'select',
                '#options' => $sale_price_min_options,
                '#default_value' => 70000,

Please let me know where did I go wrong. Many thanks in advance

1 Answer 1


Change 'All' to ''. The key should be blank. The default value is not matching the option list.

  • Thanks for your suggestion @kevin, using your approach I get the first choice as blank. What I want is have one of the items chosen by default. Oct 7, 2016 at 16:02

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.