summaryrefslogtreecommitdiff
path: root/static/f/forms.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/f/forms.js')
-rw-r--r--static/f/forms.js19
1 files changed, 17 insertions, 2 deletions
diff --git a/static/f/forms.js b/static/f/forms.js
index 603aaafc..02fad19a 100644
--- a/static/f/forms.js
+++ b/static/f/forms.js
@@ -92,8 +92,11 @@ function catSet(id, rnk) {
function dsInit(obj, url, trfunc, serfunc, retfunc) {
obj.onkeydown = dsKeyDown;
obj.onblur = function() {
- if(x('ds_box'))
- x('ds_box').style.top = '-500px';
+ // timeout to make sure the tr.onclick event is called before we've hidden the object
+ setTimeout(function () {
+ if(x('ds_box'))
+ x('ds_box').style.top = '-500px';
+ }, 100)
};
// all local data is stored in the DOM input object
obj.returnFunc = retfunc;
@@ -223,6 +226,18 @@ function dsResults(hr, obj) {
tr.itemData = l[i];
if(obj.selectedId == id)
tr.setAttribute('class', 'selected');
+ tr.onmouseover = function() {
+ obj.selectedId = this.id.substr(7);
+ var l = x('ds_box').getElementsByTagName('tr');
+ for(var i=0;i<l.length;i++)
+ l[i].className = l[i].id == 'ds_box_'+obj.selectedId ? 'selected' : '';
+ };
+ tr.onclick = function() {
+ obj.value = obj.serFunc(this.itemData);
+ if(x('ds_box'))
+ x('ds_box').style.top = '-500px';
+ obj.selectedId = 0;
+ };
obj.trFunc(l[i], tr);
tb.appendChild(tr);
}