1

Cleanup, do not allow search to take place when no keywords are provided

This commit is contained in:
Alex Yatskov 2014-09-15 18:35:01 +09:00
parent c5d966c6ae
commit 30b84608d3
2 changed files with 7 additions and 4 deletions

View File

@ -86,7 +86,7 @@
}, },
ready: function() { ready: function() {
$('.selectpicker').selectpicker(); $('#keywords').selectpicker();
$.getJSON('/node/keywords', function(keywords) { $.getJSON('/node/keywords', function(keywords) {
for (var i = 0, count = keywords.length; i < count; ++i) { for (var i = 0, count = keywords.length; i < count; ++i) {
@ -96,8 +96,11 @@
})); }));
} }
$('.selectpicker').selectpicker('refresh'); $('#keywords').selectpicker('refresh');
$('#search').prop('disabled', false); $('#keywords').change(function() {
$('#search').prop('disabled', $(this).val() === null);
});
$('#search').click(onSearch); $('#search').click(onSearch);
}); });
} }

View File

@ -22,7 +22,7 @@
<div class="form-group"> <div class="form-group">
<label for="keywords" class="col-md-2 control-label">Keywords</label> <label for="keywords" class="col-md-2 control-label">Keywords</label>
<div class="col-md-10"> <div class="col-md-10">
<select id="keywords" class="form-control selectpicker" multiple="multiple" data-max-options="4" data-live-search="data-live-search" name="keywords"></select> <select id="keywords" class="form-control" multiple="multiple" data-max-options="4" data-live-search="data-live-search" name="keywords"></select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">