From 101df4c0b9e56de56d506db485cb0f8e9165174c Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Mon, 21 Oct 2013 12:35:57 +0200 Subject: [PATCH] // Add check list filters value --- .../template/helpers/list/list_header.tpl | 4 ++- js/admin.js | 32 +++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/admin-dev/themes/default/template/helpers/list/list_header.tpl b/admin-dev/themes/default/template/helpers/list/list_header.tpl index 05f24d9a9..b16b32d6c 100644 --- a/admin-dev/themes/default/template/helpers/list/list_header.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_header.tpl @@ -72,6 +72,8 @@ {hook h=$hookName} {/if} + + {if !$simple_header}
{block name="override_form_extra"}{/block} @@ -301,7 +303,7 @@ {*Search must be before reset for default form submit*} - {if $filters_has_value} diff --git a/js/admin.js b/js/admin.js index 9513ddbce..0d3bb1009 100644 --- a/js/admin.js +++ b/js/admin.js @@ -871,7 +871,34 @@ $(document).ready(function() }); bindTabModuleListAction(); - + + //Check filters value on submit filter + $("[name='submitFilter']").click(function(event) { + var list_id = $(this).data('list-id'); + var empty_filters = true; + + $(document.body).find("input[name*='"+list_id+"Filter']").each(function() { + if ($(this).val() != '') + { + empty_filters = false; + return false; + } + }); + + $(document.body).find("select[name*='"+list_id+"Filter']").each(function() { + if ($(this).val() != '') + { + empty_filters = false; + return false; + } + }); + + if (empty_filters) + { + event.preventDefault(); + $('#'+list_id+'-empty-filters-alert').show(); + } + }); }); @@ -1077,5 +1104,4 @@ function sendBulkAction(form, action) $(form).attr('action', form_action.splice(form_action.lastIndexOf('&'), 0, '&' + action)); $(form).submit(); -} - +} \ No newline at end of file