1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/10737] Code fixes in AJAX search feature

PHPBB3-10737
This commit is contained in:
Suhaib Khan
2014-02-09 21:57:44 +05:30
committed by Cesar G
parent bc67377400
commit b5ee81dae6
3 changed files with 32 additions and 33 deletions

View File

@@ -1,23 +1,21 @@
<script>
function showHint(str)
{
if (str.length<3)
{
function showHint(str) {
if (str.length<3) {
document.getElementById("livesearch").innerHTML="";
return;
}
}
$.ajax({
url:'{S_LIVE_SEARCH_ACTION}'+"&q="+str,
success:function(result){
success:function(result) {
$("#livesearch").html(result);
}
});
}
function clearSearch()
{
document.getElementById("livesearch").innerHTML="";
function clearSearch() {
setTimeout(function () {
document.getElementById("livesearch").innerHTML="";
}, 500);
}
</script>
@@ -32,7 +30,7 @@
<fieldset class="fields1 column1">
<dl>
<dt><label for="username">{L_USERNAME}{L_COLON}</label></dt>
<dd><input type="text" name="username" id="username" value="{USERNAME}" class="inputbox" onkeyup="showHint(this.value)" onblur="clearSearch()" /> <table class="table1" id="livesearch"></table> </dd>
<dd><input type="text" name="username" id="username" value="{USERNAME}" class="inputbox" autocomplete="off" onkeyup="showHint(this.value)" onblur="clearSearch()" /> <table class="table1" id="livesearch"></table> </dd>
</dl>
<!-- IF S_EMAIL_SEARCH_ALLOWED -->
<dl>

View File

@@ -65,25 +65,23 @@
<!-- ENDIF -->
<script>
function showHint(str)
{
if (str.length<3)
{
function showHint(str) {
if (str.length<3) {
document.getElementById("livesearch").innerHTML="";
return;
}
}
$.ajax({
url:'{S_LIVE_SEARCH_ACTION}'+"&q="+str,
success:function(result){
success:function(result) {
$("#livesearch").html(result);
}
});
}
function clearSearch()
{
document.getElementById("livesearch").innerHTML="";
function clearSearch() {
setTimeout(function () {
document.getElementById("livesearch").innerHTML="";
}, 500);
}
</script>
@@ -98,7 +96,7 @@
</tr>
<tr>
<td class="row1"><b class="genmed">{L_USERNAME}{L_COLON}</b></td>
<td class="row2"><input class="post" type="text" name="username" value="{USERNAME}" onkeyup="showHint(this.value)" onblur="clearSearch()" /> <table class="tablebg" id="livesearch"></table> </td>
<td class="row2"><input class="post" type="text" name="username" value="{USERNAME}" autocomplete="off" onkeyup="showHint(this.value)" onblur="clearSearch()" /> <table class="tablebg" id="livesearch"></table> </td>
<!-- IF S_EMAIL_SEARCH_ALLOWED -->
<td class="row1"><b class="genmed">{L_EMAIL}{L_COLON}</b></td>
<td class="row2"><input class="post" type="email" name="email" value="{EMAIL}" /></td>