× If you expect answers you should describe your problem and give as much information's as possible. (SQL-Structure, Template Code, Joomla Version ...) Please read this before posting: joodb.feenders.de/support.html

Reset specific search box

  • william.kcperformance
  • william.kcperformance's Avatar
  • Offline
More
11 years 5 months ago - 11 years 5 months ago #1197 by william.kcperformance
Reset specific search box was created by william.kcperformance
I was wondering if the following is possible, I'm filling a website with car information and visitors can filter data in order to get the data of a car.
I've created a catalog that filters:
[Car brand] first selection, filters the results in:
[Model] second selection, filters the results in:
[Engine] third selection, filters the results in:
[Fuel] final selection, we now have one car selected.
[Reset] clears the previous form.

I would like to add three [clear] buttons to make it possible to refine the search, for instance I would like to reset [Engine]

At this moment [Reset] clears ALL fields.

Is there a way to refine the search with this method?
Thanks a lot for any helpful replies!
Last edit: 11 years 5 months ago by joest.

Please Log in to join the conversation.

More
11 years 5 months ago - 11 years 5 months ago #1203 by Dirk
Replied by Dirk on topic Re: Reset specific search box
You can do anything. But you must include custom code.

Untested example:
<button type="submit" onmousedown="document.searchForm.elements['gs[FIELD][]'].value=''">clear</button>

FIELD is the name of your Groupselect-Box. (e.g. category for the example database on this site)

If the button is pressed it should set the value of the select to empty and submit the form.

If you use a normal button it clears the select without submit.

This will not work for multiple selects. For multiple select you must enhance your code.
<button type="submit" onmousedown="Array.each(document.searchForm.elements['gs[FIELD][]'].options, function(item){item.selected=false});">clear</button>

Works with mootools only.
Last edit: 11 years 5 months ago by Dirk.

Please Log in to join the conversation.

Moderators: Dirkjoest