I have created view in that view I exposed sorting with dropdown field 'Distance', 'Rating', 'Review', it works fine. Now I want to convert that dropdown into checkboxes with AJAX callback. I used module Better Exposed Filters please suggest me to how to do that.

2 Answers 2


You can achieve this goal by Implementing hook_form_alter


 * Implements hook_form_alter().
function MYMODULE_form_alter(&$form, &$form_state, $form_id) {

    if ($form_id == 'views_exposed_form' && $form_state['view']->name == 'test' && $form_state['view']->current_display == 'page_1') {
       // do your alteration stuff
       $form['sort_order']['#type'] = 'radios';
        //$form['sort_by']['#type'] = 'radios';
    if ($form_id == 'views_exposed_form' && $form_state['view']->name == 'test' && $form_state['view']->current_display == 'page_2') {
       // do your alteration stuff 
  • Yes its working for me. Now I am trying to get that radios into checkboxes. for that I have to enable multi selection on sorting after that I will get checkboxes. thanks for ur efforts.
    – kkalaskar
    Jan 16, 2015 at 9:34
  • Hi @Kailash if this or any answer has solved your question please consider accepting it by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this.
    – Rupesh
    Jan 16, 2015 at 9:49

enter image description here

I Suppose this may help you using Better Exposed Filters

  • Thanks for your timely response. But as I mentioned above I am searching for "SORTING" and not a filtering.
    – kkalaskar
    Jan 16, 2015 at 7:20

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.