/** * Implements hook_form_BASE_FORM_ID_alter(). */ function MODULE_form_views_exposed_form_alter(&$form, FormStateInterface $form_state, $form_id) { $storge = $form_state->getStorage(); if (!empty($storge['view']) && $storge['view']->id() === 'my_view') { if (isset($form['actions']['reset']) && isset($form['actions']['submit'])) { $submit_id = $form['actions']['submit']['#id']; $form['actions']['reset']['#attributes']['onclick'] = 'javascript:jQuery(this.form).clearForm();jQuery("#' . $submit_id . '").trigger("click");return false;'; } } }
Drupal 8 add ajax for reset button in exposed filter views
Submitted by Thao Huynh on September 9, 2019 - 14:51