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

SPAutoComplete Behaviour

Sep 14, 2010 at 2:36 PM
Edited Sep 16, 2010 at 5:18 PM

I am trying to make use of SPServices to find information from another list in a different site within my sitecollection when I use SPAutoComplete to achieve this, I want the change of the value (say Customer) to behave similarly to SPRelatedData except I want it to actually store the values returned within the Item I am creating/updating so that reports can be created.

My issue is that when performing the .change() on the column, it's picking the value that the user is typing when you pick from the dropdown of suggestions, before the value is actually finished writing. I can't tell if this is a jQuery function that I'm unaware of, or if this is a quirk of SPAutoComplete.


				WebURL: "",
				sourceList: "{guid}",
				sourceColumn: "Customer_x0020_Name",
				columnName: "Customer",
				CAMLQuery: "",
				numChars: 0,
				ignoreCase: true,
				slideDownSpeed: "fast",
				processingIndicator: "<img src='_layouts/images/REFRESH.GIF'/>",
				debug: false
The result of typing "Cust" and the value "Customer" being returned by AutoComplete and clicking on it in this scenario is that "Cust" is displayed in the message box rather than "Customer" and I'm then trying to call GetListItems to grab another column based on that customer's info and set the values on this form based on that (e.g. CustomerNumber which isn't a dropdown, just a Number/Single rather than a dropdown - as is the Customer... so cascading doesn't apply here)

I'd appreciate any input on this!


Sep 14, 2010 at 4:37 PM


You probably don't want to use the change event, but maybe blur? It sounds like you want to grab the value which the user actually selects, not what they are typing as they get to that value.


Sep 16, 2010 at 3:50 PM
Edited Sep 16, 2010 at 5:18 PM

Bit of a fudge but this did it for me


					if($(this).css("background") == "#3399ff")


Sep 16, 2010 at 3:55 PM

Oh and also I found that the field didn't go away when I wanted (without deleting out all the characters) so added this, maybe worth including something similar as a parameter in future?