Hi,

Is there a way of adding an anchor to the end of the URL after the user has filtered a views results?

Example
User will filter a view by a certain day and get this URL "http://exmple.localhost/events?keys=&from[value][date]=2011-06-01".

But I want to add #search-results to the end of the URL "http://exmple.localhost/events?keys=&from[value][date]=2011-06-01#search..."

Thanks

Comments

dawehner’s picture

You could use hook_form_alter and alter extend the submit function to add the # to the redirect form. Not sure whether this will work in reality.

Letharion’s picture

Status: Active » Fixed

Question answered by dereine, no activity from OP.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

cosolom’s picture

Issue summary: View changes

Just in case if someone find this topic. It's possible to add anchor to the form url in hook_form_alter for exposed form.
Example for D8:

function MYMODULE_form_views_exposed_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
  /** @var \Drupal\views\ViewExecutable $view */
  $view = $form_state->get('view');
  if ($view->id() == 'MY_VIEW_ID' && $view->current_display == 'MY_VIEW_PAGE_ID') {
    $form['#action'] .= '#MYANCHOR';
  }
}