views:

128

answers:

1

Hi everyone! I have some script which is working in firefox and chrome but in IE 8 I get this error:

$.Autocompleter.defaults = {
    inputClass: "ac_input",
    resultsClass: "ac_results",
    loadingClass: "ac_loading",
    minChars: 1,
    delay: 400,
    matchCase: false,
    matchSubset: true,
    matchContains: false,
    cacheLength: 10,
    max: 100,
    mustMatch: false,
    extraParams: {},
    selectFirst: true,
//the following line throws the error, read down for error message
    formatItem: function(row) { return row[0]; },
    formatMatch: null,
    autoFill: false,
    width: 0,
    multiple: false,
    multipleSeparator: ", ",
    highlight: function(value, term) {
        return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>])(" + term.replace(/([\^\$()[]{}*.+\?\|\])/gi, "\$1") + ")(?![^<>]>)(?![^&;]+;)", "gi"), "$1");
    },
    scroll: true,
    scrollHeight: 180
};
` the specific error reads: '0' is null or not an object

can I perhaps change the the row[0] to something? This is found in jquery.autocomplete.js and it reads the same in firefox and doesn't cause the error, so i don't really want to change this if at all possible.

any advice would help thanks!

+1  A: 

This is what I am doing (basically I used formatItem function but took that out and tried what you did and it works.

function setSearchAutoComplete() {
    $("#txtContactSearch").autocomplete
   ("../DataFiles/MaintainMessages.ashx?what=GU",
       {
           //formatItem: formatItem,
           formatItem:function(row){return "<em>" + row[0] + "<em>";},
           selectFirst: true,
           minChars: 2,
           max: 50,
           cache: false
       }
   );
    $("#txtContactSearch").result(findValueCallback);
}

function findValueCallback(event, data, formatted) {
    $("#divSelectedContacts").append("<span id='C" + data[1] + "' class='selectedContact'>" + data[0] + "</span>");
}

function formatItem(row) {
    return "<em>" + row[0] + "<em>";
}

HTH

Raja
thanks man! ddd
Pete Herbert Penito