New Function in SPServices v0.5.4: SPAutocomplete
Christophe Humbert, of Path to SharePoint fame, pinged me yesterday and asked me if I had an autocomplete function in my jQuery Library for SharePoint Web Services. Unfortunately, “no” was the answer, so I decided to build one. Et voila!
There are lots of functions like this one out there available on the Web. I wanted to put one into SPServices which didn’t require anything other than the jQuery library itself. One of the great things about jQuery is the number of plugins and libraries which people are making out there. One of the drawbacks, though, is that they often require *other* plugins to function. Sometimes it’s just the jQueryUI plugin, but I wanted to make my SPAutocomplete function as lean as possible. All you need to use it is jQuery and SPServices.
The SPAutocomplete lets you provide values for a Single line of text
column from values in a SharePoint list. The function is highly configurable and can enhance the user experience with forms. Sometimes a dropdown doesn’t work well, either because of the number of potential values or the type of values it needs to contain. The SPAutocomplete function gives you a different option. Take a look at the demo page to see it in action.
The function is in v0.5.4, which is currently in alpha, but I should be releasing it soon.
Update 2010-04-12: I’ve removed the documentation which had been in this post originally now that the SPAutocomplete function has been released as part of v0.5.4 of SPServices. Please refer to the documentation on Codeplex from now on.
Love it…
Hi Marc!
Excellent feature. Just wondering if this option can be used for people picker form fields. and the list is the “All People” list in SharePoint at the root level.
Regards,
waqas
waqas:
SPAutocomplete won’t work with any type of column other than a Single line of text. The rendered markup for each type of column is unique, and the People Picker is one of the messiest. I’ve never considered building anything for a People Picker column because it already has a complex control.
M.
Demo page link is broken :(
Really liking this function, but wish there was a built in option for substrings, as it’s adding “string;#” in front of the values
@Rachel:
This function was an attempt to build something that ended up being offering in jQueryUI. I’d suggest using that instead.
That said, the values which end up in the drop down are under your control to some degree. You can convert things however you need to. Given that “string;#” is in front of the values, I expect it’s a calculated field, which I don’t think I ever intended to support.
M.
Marc, does SPAutocomplete work with SP2016? I’ve managed to get it to provide the drop-down of values. But it doesn’t allow me to select one (either with the keyboard or the mouse). Thank you!
@Erin:
I haven’t tried it, to be honest. I stopped developing that function fairly early, since jQueryUI’s autocomplete was much better and was actively developed.
M.