LimeSurvey自动完成功能

3
想象一下这个问题:“请写下五个电视剧的标题。”
我们希望答案是自发的,因此用户可以自由回忆并写下他们的答案,例如“权力的游戏”,“生活大爆炸”或“老友记”。
我们的问题是,有些人会写“big bang theory”,其他人会写“The Big Bang Show”甚至是“big ban teory”,但我们知道这些答案是相同的。
因此,我们希望LimeSurvey动态地提供一个自动完成答案,如“生活大爆炸”,以便最小化手动重写和分组答案的工作量。
这个特性可用吗?如果不行,你能实现它的任何线索吗?
1个回答

2

如果您有csv文件,可以使用以下类似的方法。

  1. download jquery.csv-0.71.js at https://code.google.com/p/jquery-csv/ and put it in your template directory.
  2. put your csv file in your template directory (name series.csv : one serie by line)
  3. Update the HTML sourve of your question with:

    <script type="text/javascript" src="{TEMPLATEURL}jquery.csv-0.71.js"></script>
    <script>
    var url = "{TEMPLATEURL}series.csv";
    $(function() {
        var seriesTitle = new Array();
    
        $.get(url,function(data){
            fullArray = $.csv.toArrays(data);
            $(fullArray).each(function(i, item){
                seriesTitle.push(item[0]);
            });
            $("#question{QID} input[type=text]").autocomplete({
                source: seriesTitle
            });
        });
    });
    </script>
    

    It work for multi text and short text.

如果需要,您可以使用API(如果可用)。查看自动完成示例以了解如何使用JSON:http://jqueryui.com/autocomplete/#remote


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接