Currently I'm working on creating a dialog window that has an autocomplete field within it. I've done autocomplete fields before, along with dialog windows, but never the two together and am finding an issue. Currently, this is what my code looks like.

//Used to dictate actions when user selects an option within autocomplete

select: function (event, ui){

//Check to see if user tried to select the "No results" option

if(ui.item.id ==0){

//Do some house cleaning and alert user to mistake

alert("You must retry your search for a Product");

$("#Name").val("");

$("#ProductId").val("");

returnfalse;

}

//Record ProductId

$("#ProductId").val(ui.item.id);

}

});

}

});

The problem begins when the autocomplete method itself is created. I get the following error:

Error: Object doesn't support this property or method.

The error points to where I make my declaration on the autocomplete functionality (within the if loop for the keypress). Originally I thought Name just wasn't being found but several tests showed that it exists. I then thought maybe it had something to do with the masterpage this view inherits, which may or may not. It includes the css for jquery-ui a second time (since dialog is part of original View technically) but even removing the second version of it does nothing.