I am implementing dependent filters in views exposed filter for content:datasource search(Solr search). I have a requirement that in exposed dropdown field when a category is selected, by ajax i need to fetch the sub-categories and show up in another dropdown.For this I tried like below but its not going to callback function only. There is nothing logging in the network console also. Can anyone help me here to resolve.
use DrupalCoreAjaxAjaxResponse; use DrupalCoreAjaxHtmlCommand; function module_form_alter(&$form, &$form_state, $form_id) { $form['field_categories']['#ajax'] = array( 'callback' => 'module_get_subcategories', // 'callback' => '::module_get_subcategories', 'event' => 'change', 'wrapper' => 'edit-field-subcategory', 'progress' => array( 'type' => 'throbber', 'message' => NULL, ), ); } function module_get_subcategories(&$form, FormStateInterface $form_state) { $response = new AjaxResponse(); $message = 'test'; $response->addCommand(new HtmlCommand('#edit-field-subcategory', $message)); return $response; }