X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=js%2Finserts.js;h=235de1812167082b813805397856340a4761a19a;hb=0ddbffd3121056b6cf10dbd715d72d10fffdf253;hp=c6c047f77f8a2238a88fd55319f7ed5aa48f40a7;hpb=0004b53d41de75563d76342c5403aa101b8a4518;p=fa-stable.git
diff --git a/js/inserts.js b/js/inserts.js
index c6c047f7..235de181 100644
--- a/js/inserts.js
+++ b/js/inserts.js
@@ -1,9 +1,8 @@
-
var _focus;
function debug(msg) {
- document.getElementById('msgbox').innerHTML=
- document.getElementById('msgbox').innerHTML+'
'+msg
+ box = document.getElementById('msgbox')
+ box.innerHTML= box.innerHTML+'
'+msg
}
function progbar(container) {
@@ -13,7 +12,6 @@ function progbar(container) {
}
function save_focus(e) {
-// document.getElementsByName('_focus')[0].value = e.name;
_focus = e.name||e.id;
var h = document.getElementById('hints');
if (h) {
@@ -44,18 +42,16 @@ function expandtab(tabcontentid, tabnumber) {
}
function _set_combo_input(e) {
- e.onblur=function() {
-// if(!this.back) {
- var but_name = this.name.substring(0, this.name.length-4)+'button';
- var button = document.getElementsByName(but_name)[0];
- var select = document.getElementsByName(this.getAttribute('rel'))[0];
- save_focus(select);
+ e.onblur=function() {
+ var but_name = this.name.substring(0, this.name.length-4)+'button';
+ var button = document.getElementsByName(but_name)[0];
+ var select = document.getElementsByName(this.getAttribute('rel'))[0];
+ save_focus(select);
// this.style.display='none';
- if(button) { // if *_button set submit search request
- JsHttpRequest.request(but_name);
- }
- return false;
-// }
+ if(button) { // if *_button set submit search request
+ JsHttpRequest.request(but_name);
+ }
+ return false;
};
e.onkeyup = function(ev) {
var select = document.getElementsByName(this.getAttribute('rel'))[0];
@@ -73,14 +69,13 @@ function _set_combo_input(e) {
}
}
};
- e.onkeydown = function(ev) {
+ e.onkeydown = function(ev) {
ev = ev||window.event;
key = ev.keyCode||ev.which;
if(key == 13) {
this.blur();
return false;
}
-// this.back = ev.shiftKey; // save shift state for onblur handler
}
}
@@ -90,13 +85,15 @@ function _update_box(s) {
var box = document.getElementsByName(rel)[0];
if(box && s.selectedIndex>=0) {
var opt = s.options[s.selectedIndex];
- if (opt.value != 0) {
if(box) box.value = byid ? opt.value : opt.text;
- }
}
}
function _set_combo_select(e) {
+ e.onblur = function() {
+ if(this.className=='combo')
+ _update_box(this);
+ }
e.onchange = function() {
var s = this;
@@ -111,22 +108,14 @@ function _set_combo_select(e) {
}
return true;
}
-// e.onblur = function() {
-// if (this.className == 'combo')
-// _update_box(this);
-// },
e.onkeydown = function(event) {
event = event||window.event;
-// this.back = event.shiftKey; // save shift state for onblur handler
key = event.keyCode||event.which;
var box = document.getElementsByName(this.getAttribute('rel'))[0];
if (box && key == 32 && this.className == 'combo2') {
this.style.display = 'none';
box.style.display = 'inline';
box.value='';
- // Konq does not like short syntax for nonstd attr
-// this.setAttribute('back', 'true');
-// this.back=true;
setFocus(box.name);
return false;
}
@@ -141,6 +130,8 @@ var inserts = {
if(e.onfocus==undefined) {
e.onfocus = function() {
save_focus(this);
+ if (this.className == 'combo')
+ this.select();
};
}
if (e.className == 'combo' || e.className == 'combo2') {
@@ -172,11 +163,6 @@ var inserts = {
e.onfocus = function() {
save_focus(this);
};
- e.onkeydown = function(event) {
- event = event||window.event;
- this.back = event.shiftKey; // save shift state for onblur handler
- this.lastkey = event.keyCode;
- };
var c = e.className;
if (c == 'combo' || c == 'combo2')
_set_combo_select(e);
@@ -202,6 +188,10 @@ var inserts = {
}
}
}
+ },
+ '#msgbox': function(e) {
+ // this is to avoid changing div height after ajax update in IE7
+ e.style.display = e.innerHTML.length ? 'block' : 'none';
}
/* TODO
'a.date_picker': function(e) {