This project has moved and is read-only. For the latest updates, please go here.

JQuery Autocomplete Stops Working After Postback

Nov 21, 2012 at 11:37 AM

I have an autocomplete script that works ok in the sense that it shows the options to select from after the user types 2 letters. Now, the problem I have is that after the selection is made and the text field is filled out, the script stops. For example, if I make a selection from the given entries, and for some reason I have clear the text field, once I start typing again, the autocomplete doesn't show anything at all.

The form performs a postback everytime I select values from a couple of dropdown controls, and I noticed the script stops once the postbacks are triggered. Is there any way I can have the scripts running after each postback?

If anybody can point the right directions, I would really appreciate it.


<link href="/Scripts/jquery-ui-1.8.22.custom.css" rel="stylesheet" type="text/css"/>
<script language="javascript" type="text/javascript">

//Wait ##### seconds for form to load before calling the function.
window.onload = function(){
    window.setTimeout(readyCall, 1000);

function readyCall(){

//Variable for Array where Title column values will be pushed to.
var Requestors = [];

//Variable for the Requestor Text Field.
var RequestorField = "input[id$='FormControl0_V1_I1_T2']"

//Call the SPServices library.
    operation: "GetListItems",
    listName: "Requestor",
    CAMLViewFields: "",
    async: false,
    completefunc: function (xData, Status){


Nov 21, 2012 at 2:23 PM

It looks like you may be using SPAutocomplete on a borwser-based Infopath form. While I've written on my blog about doing that, it's a bit clunky. I think you're simply going to have to debug further.

BTW, I don't see any autocomplete logic above, and there's also no reference to jQuery or SPServices. I assume those references are elsewhere.