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
This commit is contained in:
Hamish Friedlander 2009-05-15 02:24:50 +00:00 committed by Sam Minnee
parent 6bdb807af1
commit ddbf2e2e99

View File

@ -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