0

I have created a SharePoint page and inserted text box using content editor web part with title of FilterTextBox

<input type="text" title="FilterTextBox"/>

and I have inserted below script using Script Editor web part

<script language="javascript" type="text/javascript">
    $(document).ready(function() {
        $().SPServices.SPAutocomplete({ 
            sourceList: "Country",
            sourceColumn: "Title",
            columnName: "FilterTextBox",
            ignoreCase: true,
            numChars: 3,
            slideDownSpeed: 1000,
            debug: true
        });
    });
</script>

but I get the following error when page load

Uncaught TypeError: Cannot read property 'find' of undefined

what might be wrong with my code ? thanks .

2 Answers 2

0

This issue might occur if you don't add references for your Jquery , SPService , So make sure that you have the following references in your script.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.02/jquery.SPServices-2014.02.min.js"></script>


<script language="javascript" type="text/javascript">
    $(document).ready(function() {
        $().SPServices.SPAutocomplete({    
            sourceList: "Country",
            sourceColumn: "Title",
            columnName: "FilterTextBox",
            ignoreCase: true,
            numChars: 3,
            slideDownSpeed: 1000,
            debug: true
        });
    });
</script>

Also, Make sure that The sourceColumn name is internalName for the column by going to List Settings > Edit Column > check the URL Field= parameter. but in your case, it's Title field that its internal name also Title

/_layouts/15/FldEdit.aspx?List=%7B53AE6414%2D62F1%2D4FF8%2D979A%2D86F80090776B%7D&Field=Title

Note :

6
  • they are already inclued in master page and i have used SpServices for Filter DropDown List in oither page . Commented Sep 17, 2016 at 10:14
  • @user6599525 what's the SharePoint version ? Commented Sep 17, 2016 at 10:19
  • 2013 Enterpise Edition Commented Sep 17, 2016 at 10:26
  • What's the version of Jquery file ? jQuery 1.11.x (SPServices 2013.01+) RECOMMENDED jQuery 1.10.x (SPServices v0.7.2+) NOT jQuery 1.9.x Commented Sep 17, 2016 at 10:29
  • Jquery version is 3.0.1 and and SpService is Version 2014.02 Commented Sep 17, 2016 at 10:34
0

So, after lots of searching around and viewing source, the KEY detail was to add the following before the "SharePoint:FormField" tag in my custom form:

<xsl:comment>FieldName="Account" FieldInternalName="Title"  FieldType="SPFieldText"</xsl:comment>

Thanks to this post for finally making that obvious, although I think I missed it in an earlier reference: SPServices Stories #17: Multiple Form Fields Autocomplete for SharePoint 2010/2013 using JavaScript

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.