OPEN REQUEST FOR HELP TO CODERS. Filter issue.

  • Posts: 634
  • Thank you received: 16
11 years 6 months ago #103997

THIS IS AN OPEN REQUEST FOR HELP TO ANYBODY WITH A KNOWLEDGE ON CODING PHP/JAVASCRIPT

I have a problem with TEXT BOX FILTER and OnClick event. I coded a button than cleans all filters in a module at once. The module has 4 dropdown filters and a text filter.

When coding a button that cleans only the dropdown filters it works always, no matter how many of the filters are active, this is the code:


<tr><td><span class="hikashop_filter_button_outside" style="float:right"><a class="hikashop_cart_button_cancel" id="hikashop_filter_button_module_111"

onclick="

document.getElementById('filter_Mastil_module_111').value=' ';

document.getElementById('filter_Carga_module_111').value=' ';

document.getElementById('filter_Marca_module_111').value=' ';

document.getElementById('filter_Tipo_module_111').value=' ';

document.forms.submit(); return false;"

href="http://localhost:8888/activacions/index.php/catalogo-de-carretillas" >Anular búsqueda</a></span></td></tr>

When coding the same button adding the cancellation for the text filter it won't work at all (none of the filters cleared) unless there is some text assigned to the TEXT filter:


<tr><td><span class="hikashop_filter_button_outside" style="float:right"><a class="hikashop_cart_button_cancel" id="hikashop_filter_button_module_111"

onclick="

document.getElementById('filter_Mastil_module_111').value=' ';

document.getElementById('filter_Carga_module_111').value=' ';

document.getElementById('filter_Marca_module_111').value=' ';

document.getElementById('filter_Tipo_module_111').value=' ';

document.getElementById('filter_Buscar_por_texto_module_111').value=' ';

document.forms.submit(); return false;"

href="http://localhost:8888/activacions/index.php/catalogo-de-carretillas" >Anular búsqueda</a></span></td></tr>


LOOKS LIKE THE call of document.getElementById('filter_Buscar_por_texto_module_111').value=' ' is canceling the whole set of functions when that filter content is empty.


UPDATE:

As an alternative to all this mess of code MAYBE SOMEBODY HAS A SIMPLER IDEA on how to reset filters to default value and clean the filter query. Here there is an interesting post that can give some idea:

www.hikashop.com/en/forum/2-general-talk...lters-mechanics.html

This 'tweak' changes the general filter philosophy and the code might bring some clue on how to make a simple RESET button for filters.

Last edit: 11 years 6 months ago by PeterChain. Reason: Added request for an alternative solution
The following user(s) said Thank You: Bendite

Please Log in or Create an account to join the conversation.

Time to create page: 0.054 seconds
Powered by Kunena Forum