1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-17 12:00:41 +02:00

Respect numbers in autocomplete

This commit is contained in:
Jakub Vrana
2011-05-05 07:46:36 +02:00
parent dd295df9bd
commit 24e66c2812
3 changed files with 9 additions and 8 deletions

View File

@@ -18,16 +18,17 @@ function whisperClick(event, field) {
}
function whisper(url, field) {
if (field.orig != field.value) {
if (field.orig != field.value) { // ignore arrows, Shift, ...
field.orig = field.value;
field.previousSibling.value = field.value; // accept number, reject string
return ajax(url + encodeURIComponent(field.value), function (xmlhttp) {
if (xmlhttp.status && field.orig == field.value) {
if (xmlhttp.status && field.orig == field.value) { // ignore old responses
field.nextSibling.innerHTML = xmlhttp.responseText;
field.nextSibling.style.display = '';
var a = field.nextSibling.firstChild;
if (a && a.firstChild.data == field.value) {
field.previousSibling.value = decodeURIComponent(a.href.replace(/.*=/, ''));
a.style.fontWeight = 'bold';
a.className = 'active';
}
}
});