Firefox probabaly ignores clicks on the scroll bar and thus does not
lose focus. Here is the main part of the code
var auto_cust;
var auto_bran;
var auto_call;
new Event.observe(window, 'load', pageload);
function pageload() {
auto_cust = new Ajax.Autocompleter('customer', 'customer_auto',
'logform_customer.asp', {minChars:-1,frequency:0.5,afterUpdateElement:
getCustomerId});
auto_bran = new Ajax.Autocompleter('branch', 'branch_auto',
'logform_branch.asp', {minChars:-1,frequency:0.5,callback:
customerCallback,afterUpdateElement: getBranchId});
auto_call = new Ajax.Autocompleter('caller', 'caller_auto',
'logform_caller.asp', {minChars:-1,frequency:0.5,callback:
customerCallback});
new Event.observe('customer', 'focus', acust);
new Event.observe('branch', 'focus', abran);
new Event.observe('caller', 'focus', acall);
$('customer').focus();
}
function acust()
{
auto_cust.activate(); //twice because IE is clever
auto_cust.activate();
}
function abran()
{
auto_bran.activate(); //twice because IE is clever
auto_bran.activate();
}
function acall()
{
auto_call.activate(); //twice because IE is clever
auto_call.activate();
}
function getBranchId(text, li) {
$('branch_id').value =
li.id;
$('caller').focus();
}
function getCustomerId(text, li) {
$('customer_id').value =
li.id;
$('branch').value='';
$('branch_id').value='';
$('branch').focus();
}
function customerCallback(element, entry) {
return entry + "&customer=" + $('customer_id').value;