+ autosubmit by choosing a value in the search autocomplete list

This commit is contained in:
kelson42 2012-08-14 16:21:28 +00:00
parent 68cf5e4977
commit f553cee7b4
1 changed files with 8 additions and 2 deletions

View File

@ -1,7 +1,13 @@
<script> <script>
$(function() { $(function() {
$( "#kiwixsearchbox" ).autocomplete({ $( "#kiwixsearchbox" ).autocomplete({
source: "/suggest?content=__CONTENT__"
source: "/suggest?content=__CONTENT__",
select: function(event, ui) {
$( "#kiwixsearchform" ).submit();
},
}); });
}); });
</script> </script>
@ -9,7 +15,7 @@
<span id="kiwixtoolbar" class="ui-widget-header ui-corner-all"> <span id="kiwixtoolbar" class="ui-widget-header ui-corner-all">
<button id="kiwixlibrary" onclick="window.location.href='/';">Library</button> <button id="kiwixlibrary" onclick="window.location.href='/';">Library</button>
<button id="kiwixhome" onclick="window.location.href='/__CONTENT__/';">Home</button> <button id="kiwixhome" onclick="window.location.href='/__CONTENT__/';">Home</button>
<form method="GET" action="/search" /> <form method="GET" action="/search" id="kiwixsearchform"/>
<input type="hidden" name="content" value="__CONTENT__" /> <input type="hidden" name="content" value="__CONTENT__" />
<input type="submit" id="kiwixsearch" value="Search" /> <input type="submit" id="kiwixsearch" value="Search" />
<input id="kiwixsearchbox" name="pattern"/> <input id="kiwixsearchbox" name="pattern"/>