SPAutocomplete does not autocomplete.

Sep 30, 2013 at 2:52 PM
jQuery().SPServices.SPAutocomplete({
WebURL: "https://MYPROJECT.sharepoint.com/test",
sourceList: "Contact",
sourceColumn: "Title",
columnName: "Organisation",
filterType: "Contains",
numChars: 0,
ignoreCase: true,
highlightClass: "ms-bold",
uniqueVals: false,
slideDownSpeed: "fast",
debug: false
});

Im currently using this code for getting info from a column in a list in Sharepoint Online 2013. Everything works fine EXCEPT the autocomplete part. I get the results shown in drop down, but when I click it doesn't autocomplete, the drop down just disapears. Does someone know why?

Regards
Robin
Coordinator
Oct 3, 2013 at 4:41 PM
I'm not sure what's happening, Robin. Have you done any debugging?

M.
Nov 8, 2013 at 6:49 PM
I'm having the same issue. We have SP2010 Enterprise, using jQuery 1.7.2 and SPServices 0.7.2.min. I'm using the auto complete with an HTML Form Web Part.
<div onkeydown="javascript:if (event.keyCode == 13) _SFSUBMIT_"><input type="text" name="T1" Title="Plan Number"/><input type="button" value="Go" onclick="javascript:_SFSUBMIT_"/></div>
The values for the auto complete display, but when I click on one of them nothing happens. This is what I have in the script that I added to the page with a CEWP.
<script language="javascript" type="text/javascript" 

src=".../JQuery/1.7.2/jquery-1.7.2.js"></script>
<script language="javascript" type="text/javascript" 

src=".../JQuery/SPServices/jquery.SPServices-0.7.2.min.js"></script>
<script language="javascript" type="text/javascript">
    $(document).ready(function() {
        $().SPServices.SPAutocomplete({ 
            sourceList: "Sales",
            sourceColumn: "Plan_x0020_Number",
            columnName: "Plan Number",
            filterType: "BeginsWith",           
            ignoreCase: true,
            numChars: 1,
            slideDownSpeed: "fast",
            uniqueVals: true,
            debug: true
        });
    });
</script>
Any ideas?
Aug 28, 2014 at 9:04 PM
I'm having the same issue in SharePoint 2013 On-Premises. This only started happening after we migrated from 2007 to 2013. I've been scouring for answers on this everywhere but with no luck. Since the code worked pre-migration, I don't think that's the issue. Debugging returns a syntax error at the point of selecting an option from the autocomplete dropdown.

SCRIPT5022: Syntax error, unrecognized expression: #Title_fa564e0f-0c70-4ab9-b863-0177e6ddd247_$TextField

What is strange is that the issue doesn't happen when I create a new list, but that's not an option for me. I compared the page code side by side but nothing looks different. I finally resorted to copying a list view web part from a new list and changed the various properties. After doing this, the autocomplete actually populated the field. I'm baffled. Especially when creating a new list view webpart on the page didn't work either.

I won't promise this will solve anyone else's problem but it happened to work for me. Hopefully it will help someone else that's banged their head on the keyboard long enough. I'd be interested to know what causes this.

Marcus
Coordinator
Sep 6, 2014 at 6:23 PM
Marcus:

I'm not sure I understand where the issue is or what you did to fix it (or isn't it fixed?).

I really recommend using the jQueryUI autocomplete function with GetListItems to serve it data. It's got a lot more features and more reliable functionality.

M.
Sep 11, 2014 at 9:00 PM
The issue was that the item selected in the autocomplete dropdown didn't populate in the corresponding field. This started happening after a migration from 2007 to 2013. What I ended up doing was copying chunks of code from another form for the particular list and eventually the issue went away.

I will give the jQueryUI autocomplete a try, I have not used that as of yet.
Sep 24, 2014 at 10:08 PM
Was having the same issue after upgrading from SP2010 to SP2013. Was able to fix it by upgrading to jquery.SPServices-2014.01.min.js.

Hope that helps!
Jun 15 at 5:46 PM
So the reason why it doesn't autocomplete is because SharePoint 2013 inserts "$" in the id of the form column id. The way I worked around is this:

var fieldId = $("input[title='colTitle'").attr('id');
var newId = fieldId.replace("$", "");
$($("input[title='colTitle'").attr('id', newId);

The $ sign breaks sizzle which is included in all jquery libraries. Once you remove the $ sign from the id, it works beautifully.
The only thing I am trying to get it to do now is make the arrow keys work on the keyboard.....if anyone figured that out, I would love to get some ideas.
kat