Sep 08 2016 04:16 AM - edited Sep 08 2016 04:40 AM
Sep 08 2016 04:16 AM - edited Sep 08 2016 04:40 AM
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.
Sep 08 2016 02:05 PM
Have you tried to ping Marc Anderson?
Sep 08 2016 09:59 PM
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.
Sep 09 2016 04:23 AM
Sep 09 2016 04:26 AM
Sep 09 2016 09:21 AM
SolutionThanks 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.
Sep 09 2016 09:21 AM
SolutionThanks 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.