I got a request form Charlie on how to accomplish autocomplete for a single line text-field, reading the values from itself.
This solution resembles my Autocomplete for SharePoint people picker, but it pulls date into a single line text field.
As always we start like this:
In addition to the above scripts, i have the jQuery UI 1.8 in a separate folder. See the CEWP code and point the links to your jQuery UI location.
The jQuery UI-library is found here. The pictures and the sourcecode refers to jquery-ui-1.8. The autocomplete widget is not found in previous releases.
The jQuery-library is found here. The pictures and the sourcecode refers to jquery-1.4.2.min. The autocomplete widget is not supported in previous releases.
The scripts “interaction.js” and “stringBuffer.js” is created by Erucy and published on CodePlex.
Read here how to add a CEWP to the NewForm or EditForm, how to find the list Guid of your list, and how to find the FieldInternalName of your columns.
Add a CEWP below the list form in NewForm or EditForm, and insert this code:
Ask if anything is unclear.
11 thoughts on “Autocomplete for single line of text”
I am so close!
I did a test on a list with just a Title field (to keep it simple) and pre-added a few list items.
I downloaded the jQuery UI8, and changed the CEWP to match my paths for the CSS and the js files, as well as my list field (‘Title’, ‘Title’,’my list guid here,”.
I added the CEWP to my newform.aspx below the form contents.
I can see the hourglass flash quickly for each letter I type, so I know I am close!!
I tried adding my path to get to the list (like http://mysite.com/sites/sitename – which is what normally proceeds /_vti_bin/ ) and still nothing.
Hi, did you specify the paramenter “listBaseUrl” to reflect your managed path?
If you insert an alert between line 23 and 24 like this:
and it alerts -1, something is wrong with the listName (or GUID) or the listBaseUrl.
We have a holiday weekend coming up. I will try this next week. Thank you so much!!
All working fine – another great script – cheers Alexander!
what if I need a multiselect field?
Look here for the jQueryUI reference.
To start, this is a great script. Thank you!
All works fine when I implement it on a default form, however something goes wrong once I create a custom form in SP Designer. Looking at the form page’s generated HTML, it no longer includes the fieldName, which is what the targetFIN in your code is looking for. Has anybody else had an issue with this on custom forms?
Look at this article
Thank you very much! Adding the IDs and the code change in the link you sent worked great!
Alexander, if you have a chance, can you update this script to remove the dependence on stringbuffer and interaction.js? Or, maybe you could roll this into DFFS? Thanks!