Hi all,

I'm having some trouble with the autocomplete plugin from
bassistance.de
I'm doing a multiple-select box, original code copied from the
example, but there are a couple of things that I need changing:

1. I don't want the result function to trigger when a new item is
selected as it does in the example
2. I want the "get values" function to be triggered from outside the
div that the select box is in (it's currently result(function).next...

Also, this current bit of code I've got doesn't want to work in Opera
(9.2) but will work in FF/IE

Any help would be great thanks, I've only just got into jQuery and I'm
loving it, but some things are tricky (especially late at night!)

Many thanks

Steve
Steel Software

Code:

$(document).ready(function(){
        function formatItem(row) {
                return row[0]+" ("+row[2]+", "+row[4]+" "+row[3]+")";
        }

        function formatResult(row) {
                return row[0];
        }
        function findValueCallback(event, data, formatted) {
                $("<li>").text( !data ? "No match!" : "Selected: " +
formatted).appendTo("#result");
        }
$("#squadSearch").autocomplete("ajax/searchpeople.php", {
                delay: 150,
                multiple: true,
                mustMatch: true,
                autoFill: true,
                formatItem: formatItem,
                formatResult: formatResult,
        });
// This line needs to be changed for the submit to work!!
$("#squadSearch").result(findValueCallback).
("input#submit").click(function() {
                $(this).prev().search();
        });
});

Reply via email to