Posted By

morningtime on 01/12/10


Tagged

ajax jquery drupal


Versions (?)

Last Edited at 01/12/10 08:43am

Viewed 6 times

Drupal Views AJAX Reset Button for Exposed Filters in


/ Published in: PHP

URL: http://drupal.org/node/99370#comment-2465716

What it does: clears & submits exposed filters form via AJAX (if enabled, otherwise normal page refresh).

This is for Views 2.x. It works with the 'remember me' option.

You need to create a custom module. E.g. custom/custom.module and custom/custom.info. Enable your custom module via admin/build/modules.

  1. function CUSTOM_form_alter(&$form, $form_state, $form_id) {
  2. if ($form_id == 'views_exposed_form') {
  3. $form['reset'] = array(
  4. '#type' => 'markup',
  5. '#value' => '<input '. drupal_attributes(array('type' => 'button', 'value' => t('Reset') )) .'onclick="javascript:$(this.form).clearForm();$(this.form).submit();" class="form-submit" />',
  6. );
  7. }
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.