From ddbf2e2e99ec364f9297b452b1f5a2227355ef83 Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Fri, 15 May 2009 02:24:50 +0000 Subject: [PATCH] MINOR: Make return trigger search, not clear, on SiteTree Filter git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@76943 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/CMSMain_left.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/javascript/CMSMain_left.js b/javascript/CMSMain_left.js index f652c74d..8250dd66 100755 --- a/javascript/CMSMain_left.js +++ b/javascript/CMSMain_left.js @@ -195,7 +195,16 @@ SiteTreeFilterForm.prototype = { onsubmit: function() { var filters = $H(); - if (this.clicked == 'Search') { + if (this.clicked == 'Clear') { + Form.getElements(this).each(function(el){ + if (el.type == 'text') el.value = ''; + else if (el.type == 'select-one') el.value = 'All'; + }); + document.getElementsBySelector('.SearchCriteriaContainer', this).each(function(el){ + Element.hide(el); + }) + } + else { Form.getElements(this).each(function(el){ if (el.type == 'text') { if ($F(el)) filters[el.name] = $F(el); @@ -205,15 +214,6 @@ SiteTreeFilterForm.prototype = { } }); } - else { - Form.getElements(this).each(function(el){ - if (el.type == 'text') el.value = ''; - else if (el.type == 'select-one') el.value = 'All'; - }); - document.getElementsBySelector('.SearchCriteriaContainer', this).each(function(el){ - Element.hide(el); - }) - } if (filters.keys().length) { // Set new URL