SOLVED

SpServices.SpAutocomplete - problem with jquery

Deleted
Not applicable

Hello,

 

Following this https://github.com/sympmarc/SPServices/wiki/SPAutocomplete i'm trying to build an autocomplete field on SharePoint online(O365)

 

I have followed all instructions but cannot seem to make it work.

The following script works, it returns the current site name.

---------------------------------------------------------------------------------------------------------------------

<script language="javascript" src="/JS/jquery-3.1.0.min.js" type="text/javascript"></script>
<script language="javascript" src="/JS/jquery.SPServices-2014.01.min.js" type="text/javascript"></script>


<script language="javascript" type="text/javascript">

$(document).ready(function() {

alert("jQuery");
alert($().SPServices.SPGetCurrentSite());

});

</script>

 

---------------------------------------------------------------------------------------------------------------------

 

The actual script does not work:

---------------------------------------------------------------------------------------------------------------------

<script language="javascript" src="/JS/jquery-3.1.0.min.js" type="text/javascript"></script>
<script language="javascript" src="/JS/jquery.SPServices-2014.01.min.js" type="text/javascript"></script>


<script language="javascript" type="text/javascript">

$(document).ready(function() {
$().SPServices.SPAutocomplete({
sourceList: "List1", 
sourceColumn: "Title", 
columnName: "CurrentTitle", 
numChars: "3",
filterType: "Contains", 
ignoreCase: "true", 
highlightClass: "ms-bold", 
slideDownSpeed: "fast", 
debug: "true" 
});
});

 

</script>

---------------------------------------------------------------------------------------------------------------------

 

Does anyone have an ideea why it's not working? On-premise SP 2010 the exact same code works. Are there any limitations in SharePoint Online?

 

Thank you,

Catalin.

5 Replies

Have you tried to ping Marc Anderson?

Thanks, i'll do that.

 

@Marc Anderson - do you have an ideea why the above code is not working in SPO?

 

Thanks in advance,

Catalin.

Catalin:

There are many things changing in SharePoint Online all the time, and I haven't even tried to keep up. I don't see anything obvious about what you're doing that wouldn't work.

In any case, there are better autocomplete options, like jQueryUI's or Bootstrap's.

M.
p.s. I haven't done any testing with jQuery 3.x. You might try 1.x. Also, SPServices 2014.02.

M.
best response
Solution

Thanks Marc and Juan Carlos for your help.
 
After a little bit of reasearch and some help I managed to get it done with jQueryUI and SPServices.
I attached the script in a .docx file if anyone ever wants to use it.
There are some things that need to be modified depending on the list, field names and fiels id's used - i marked all things with "ToModify_".
 
The script needs to be loaded in a CEWP on newform.aspx and it does the following:
 - it reads the data from a list with two columns(it reads only the Title field) -  it populates the autocomplete Title field for the current list
 - when you SELECT the line that you want it then searches for the second field(populated with usernames) wich corresponds with the line selected and populates a people picker field and resolves the person.
 
Hope this helps someone.
 
Thanks.
Catalin.

1 best response

Accepted Solutions
best response
Solution

Thanks Marc and Juan Carlos for your help.
 
After a little bit of reasearch and some help I managed to get it done with jQueryUI and SPServices.
I attached the script in a .docx file if anyone ever wants to use it.
There are some things that need to be modified depending on the list, field names and fiels id's used - i marked all things with "ToModify_".
 
The script needs to be loaded in a CEWP on newform.aspx and it does the following:
 - it reads the data from a list with two columns(it reads only the Title field) -  it populates the autocomplete Title field for the current list
 - when you SELECT the line that you want it then searches for the second field(populated with usernames) wich corresponds with the line selected and populates a people picker field and resolves the person.
 
Hope this helps someone.
 
Thanks.
Catalin.

View solution in original post