Attached is a module I have created for adding a reset button to forms created by Views 2.x with exposed filters. I am calling it "Views reset filters". It is inspired by the thread #99370: Add a 'reset' button to exposed filters. Since a patch was only committed to the upcoming 3.x version of Views for D6, I needed a simple solution for the stable Views 2.x I am using on several D6 sites.

The module is basically based on what has been posted to http://drupal.org/node/99370#comment-2886076, but with the following enhancements:

  • Works also when Drupal is installed in a sub directory
  • Thy style of the button is identical to the "Apply" submit button
  • The button will only be displayed when the View is viewed with a query string. This means after clicking the "Reset filters" button it won't be displayed again, since there is nothing to reset
  • Module displays in the Modules admin page with a version number
  • Code validates with Coder 6.x-2.x
  • Has been successfully tested with the latest stable Views 2 for D6 (6.x-2.10)
CommentFileSizeAuthor
views_reset_filters-6.x-0.1.tar_.gz801 bytesroball

Comments

merlinofchaos’s picture

Modules don't work very well in the Views issue queue, and 2.x is probably not going to get this feature (it exists in 3.x). You could apply for CVS access and contribute this as a module, if you like; but I'd rather have this somewhere else besides the issue queue.

roball’s picture

@merlinofchaos: Thank you for commenting and suggesting to contribute this as a project. Could this issue be kept active until this has been done?

P.S. to the module description:
I forgot to mention that unlike the "original" module, nothing has to be "customized". Just enable the module and all forms with exposed filters will have the extra button.

nodecode’s picture

Status: Closed (won't fix) » Active

@roball: Great work editing the module! This is what i really wanted in the first place, but i just didn't have the skills. Looking forward to testing this out on my own site.

@merlinofchaos: IMHO this should maybe be a standard feature of Views in every version (personally I just care about the 6.x-2.x branch though). If you look at the thread from which this originated, user dereine stated that she had committed something similar to this module in the 6.x-3.x branch, though she didn't specify what was committed. Please look at the question I asked her at the end of this post: http://drupal.org/node/99370#comment-2886076 to make sure the best solution gets committed (my vote is for this module if we can prove it works for more users).

merlinofchaos’s picture

I'm sorry, there is no voting on this issue. This is a feature in 3.x. It will not be a feature in 2.x. End of story.

dawehner’s picture

To explain why:

Views3 has a new pluggable exposed forms. So you can easily add other forms, for example the reset button, to the forms.
In views2 this is not possible that easy currently.

If you need this feature, i suggest to test views3 and fill bugs\create suggestions or test patches. Then views3 will come out earlier.

merlinofchaos’s picture

Status: Active » Closed (won't fix)

Alternatively, if someone wants to put the module that does this into contrib, that would be great.

Won't-fixing this. This doesn't need to be open in the Views queue anymore.

nodecode’s picture

@dereine: thanks for the explanation, i think i'll use this helper module for now until Views 3 is ready. thanks for implementing the reset button in Views 3.

roball’s picture

Status: Active » Closed (won't fix)

This module is now obsolete since infojunkie has now released such a module as part of the Views Hacks package.