This is the http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/
plugin

Hi, I've encountered an error with the autocomplete plugin.
We have 2 textboxes, both with different sources of data to populate
the autocomplete.
Only 1 textbox is visible at one time, both appearing in the same
place.
2 links appear above the textbox which toggle visibility of the 2
textboxes.

<ul class="searchScope">
    <li><a id="searchScopeAll" href="javascript:void(0)">Search All</
a></li>
    <li><a id="searchScopeStaff" href="javascript:void(0)">Search
Staff</a></li>
</ul>
<div id="searchBox">
    <input id="searchTextBox" type="text" class="textBox" value="" />
    <input id="searchStaffTextBox" type="text" class="textBox"
value="" />
    <input id="searchSubmit" type="submit" class="button"
title="Search" value="" />
</div>

In document load I attach the autocomplete to both textboxes

$("#searchTextBox").autocomplete(urlTagData, autocompleteTagOptions);
$("#searchStaffTextBox").autocomplete(urlUserData,
autocompleteStaffOptions);

All this works fine.

The problem arises when I click 1 of the links to toggle the
checkboxes when one of the autocomplete dropdown is visible. When
there is no autocomplete dropdowns visible it works fine.

$("#searchScopeAll").click(function() {
        $("#searchTextBox").show().focus().flushCache();
        $("#searchStaffTextBox").hide();
    });

$("#searchScopeStaff").click(function() {
    $("#searchStaffTextBox").show().focus();
    $("#searchTextBox").hide();
});

The error is
Line 15
Error: Can't move focus to the control because it is invisible, not
enabled, or of a type that does not accept the focus.

Debugging is VisualStudio found the error to be in
jquery.autocomplete.js at field.focus();
If I remove field.focus(); from jquery.autocomplete.js everything
seems to work fine.

Can anyone shed any lght onto this one?

cheers

Reply via email to