0

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.

1

You can achieve this goal by Implementing hook_form_alter

e.g:

/**
 * 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';
    }else
    if ($form_id == 'views_exposed_form' && $form_state['view']->name == 'test' && $form_state['view']->current_display == 'page_2') {
       // do your alteration stuff 
    }
}
2
  • 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 '15 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 '15 at 9:49
1

enter image description here

I Suppose this may help you using Better Exposed Filters

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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