Input_ItemInfo_Units.setEvent("onkeyup", function(event){
var key=String.fromCharCode(event.keyCode || event.charCode);
switch (event.keyCode) {
case 38:case 40:case 37:case 39:
case 33:case 34:case 36:case 35:
case 13:case 9:case 27:case 16:
case 17:case 18:case 20:case 8:
case 46:
return;
break;
};
var tbox = this.getContent("box/text").element();
var tboxValue=tbox.value;
var i;
var found=false;
for(i=0;i<this.getItemCount();i++){
if(this.getItemText(i).toUpperCase().indexOf(
tboxValue.toUpperCase()) == 0){
found=true;
break;
}
}
var sText = event.charCode;
var iStart = tbox.selectionStart;
tbox.setSelectionRange(iStart+sText.length, iStart+sText.length);
var iLen = tbox.value.length;
if(found){
tbox.value = this.getItemText(i);
this.setCurrentItem(i);
}else{
tbox.value = '';
}
tbox.setSelectionRange(iLen, tbox.value.length);
return;
});
Input_ItemInfo_Units.setEvent("onkeyup", function(event){
var key=String.fromCharCode(event.keyCode || event.charCode);switch (event.keyCode) {case 38:case 40:case 37:case 39:case 33:case 34:case 36:case 35:case 13:case 9:case 27:case 16:case 17:case 18:case 20:case 8:case 46:return;break;};
var tbox = this.getContent("box/text").element();
var tboxValue=tbox.value;
var i;
var found=false;
for(i=0;i<this.getItemCount();i++){
if(this.getItemText(i).toUpperCase().indexOf(tboxValue.toUpperCase())==0){
found=true;
break;
}
}
var iLen = tbox.value.length;
if(found){
tbox.value = this.getItemText(i);
this.setCurrentItem(i);
}else{
tbox.value = '';
}
if(tbox.setSelectionRange) {
tbox.setSelectionRange(iLen, tbox.value.length);
} else {
var oRange = tbox.createTextRange();
oRange.moveStart("character", iLen);
oRange.moveEnd("character", tbox.value.length-iLen);
oRange.select();
}
tbox.focus();
return;
});
// .... on the Validating event....
if(ItemInfo_Units.indexOf(text) < 0) {
alert("Invalid Value");
this.setCurrentItem(lastValue);
return;
} else {
lastValue = ItemInfo_Units.indexOf(text);
this.setCurrentItem(lastValue);
}
This topic is archived.