jquery plugin and autocomplete

4 years 2 months ago #112634 by EducatedPredictions
EducatedPredictions created the topic: jquery plugin and autocomplete
I am trying to use a csv to autocomplete a question in one of my surveys. I believe I followed the instructions right in the manual.

Here is what i came up with for my php:
        $collegesArr = array();
        $file_handle = fopen("colleges.csv", "r");
        while (!feof($file_handle) ) {
                $line_of_text = fgetcsv($file_handle);
                array_push($collegesArr, $line_of_text[0]);
        echo json_encode($collegesArr);
And here is what I came up with for my js source:
<script type="text/javascript" charset="utf-8">
        $(document).ready(function() {
                var qID = 111;
                var url = "templates/sherpa/colleges.php";
                var dataArr = [];
                        $.each(data,function(i, item){
                        $('#question'+qID+' input.text').autocomplete({
                                source: dataArr

In terms of the jquery ui plugin - are there additional steps that I am not taking that is preventing this from working? I have tried the full url of the php file with no luck. Thanks for any help anyone can offer.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!