I am trying to add a reset button to my views 2 exposed filters. I have found this snippet for 5.x drupal.org/node/292744 . Does anyone have similar code for 6.x? .... or can anyone advise how to modify the referenced 5.x code. Thanks

Comments

WorldFallz’s picture

It's not tagged d6, but this recent planet post should work: http://fleetthought.com/blog-post/adding-reset-button-exposed-views-filters

jdm843’s picture

Just what I was looking for....will try it tomorrow!

jmlavarenne’s picture

Same but with multilingual button value :

/**
* Implementation of hook_form_alter().
*/
function custom_formalter_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'views_exposed_form') {
    $exposed_views = array('Calendrier');
    if (in_array($form_state['view']->name, $exposed_views)) {
      $reset_button_value = t('Reset');
      $current_display = $form_state['view']->current_display;
      $form['reset'] = array(
        '#type' => 'markup',
        '#value' => '<input class="form-button" type="reset" 
value="'. $reset_button_value . ' " onClick="javascript:window.location=\'/'. 
$form_state['view']->display[$current_display]->
display_options['path'] .'\';" />',
      );
    }
  }
}