"An illegal choice has been detected. Please contact the site administrator." with exposed sort fields I have a panel which displays a page that was created in views. When a user clicks the next button on the pager, it displays the error "An illegal choice has been detected. Please contact the site administrator." 

I've tracked this problem down to being caused by my exposed fields I use for sorting: When the pager is clicked, it submits to a URL like http://mysite.com/reviews?myfieldtosort_tid=All&amp;sort_by=&amp;sort_order=DESC&amp;page=0%2C0%2C1.

The problem is that sort_by is empty; if I remove that attribute entirely the problem goes away. Alternatively, if I use the exposed sort, it adds the sort field and also works correctly.

What can I do to still use the pager, but have it remove the sort_by field when it is not needed?
I've solved by setting a default value in the form alter callback for views exposed form

function mymod_form_views_exposed_form_alter(&amp;$form, &amp;$form_state) {
  if($form_state['view']-&gt;name == 'yourviewname') {
    $_GET['sort_by'] = 'default_sort_name';
    $form_state['view']-&gt;set_exposed_input($_GET);  
    $form_state['input']['sort_by'] = $_GET['sort_by'];
  }
}