- Posts: 12
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
The authors of the paper are correct since it is not possible with the LS alone. The scope of LS and Surveymonkey won't cover the kind of questions where social graph data is retrieved and displayed as a question stimulus with UI.Joshi wrote: but they wrote that it´s not possible with LS – I’m pretty sure it is!
This survey seems to be done with the codeface framework, which is available for free.Joshi wrote: rfhinf067.hs-regensburg.de/survey/?p.id=1&c.id=1
<script type="text/javascript" src="{TEMPLATEURL}jquery.csv.js"></script> <script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:complete',function() { var url = "{TEMPLATEURL}kursnamen.csv"; var inputError = 'That is not a valid name'; var duplicateError = 'That is a duplicated name'; var Names = new Array(); $.get(url,function(data){ fullArray = $.csv.toArrays(data); $(fullArray).each(function(i, item){ Names.push(item[0]); }); $("#question{QID} input[type=text]").autocomplete({ source: Names, select: function(event, ui) { // Test for duplicates var duplicates = false; var inputValue = $.trim(ui.item.value); $("#question{QID} input[type=text]").not($(this)).each(function(i) { if($.trim($(this).val()) == inputValue) { duplicates = true; } }); if(duplicates == true) { flashError(this, duplicateError); return false; } }, change: function(event, ui) { // Test for value in list if (!ui.item) { this.value = ''; flashError(this, inputError); } $(this).trigger('keyup'); } }); }); function flashError(el, errortext) { var thisBackground = $(el).css('background-color'); $(el).css('background-color', 'pink').val(errortext); setTimeout(function() { $(el).css('background-color', thisBackground).val('').trigger('keyup'); }, 1500); } }); </script>
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:complete',function() { // A function to add or remove rows of a multiple-short-text question function varLengthArray(qID) { // The HTML content of the Add/Remove elements - modify as you wish var addContent = '[+]'; var removeContent = '[-]'; // Insert the buttons $('#question'+qID+' .subquestion-list').append('<div id="addButton'+qID+'" class="control-button">'+addContent+'</div><div id="removeButton'+qID+'" class="control-button">'+removeContent+'</div>'); // Style the elements - you can modify here if you wish $('#question'+qID+' .control-button').css({ 'margin':'10px 0 0 10px', 'padding':'1px', 'text-align':'center', 'font-weight':'bold', 'width':'auto', 'cursor':'pointer', 'float':'left' }); // Initially hide the Remove element $( 'div#removeButton'+qID ).hide(); // Call the functions below when clicked $( 'div#addButton'+qID ).click(function (event) { addRow(qID); }); $( 'div#removeButton'+qID ).click(function (event) { removeRow(qID); }); // Function to add a row, also shows the Remove element and hides the function addRow(qID) { $('#question'+qID+' .answer-item:hidden:first').show(); $('div#removeButton'+qID).show(); if ($('#question'+qID+' .answer-item:visible').length == $('#question'+qID+' .answer-item').length) { $('div#addButton'+qID).hide(); } } // Function to remove a row and clear the input value function removeRow(qID) { $('#question'+qID+' .answer-item:visible:last').hide(); $('#question'+qID+' .answer-item:hidden input[type="text"]').each(function(i) { $(this).val('').trigger('keyup'); }); $( 'div#addButton'+qID ).show(); if ($('#question'+qID+' .answer-item:visible').length == 1) { $('div#removeButton'+qID).hide(); } } // Just some initialization stuff // Initially hide all except first row or any rows with populated inputs $('#question'+qID+' .answer-item input[type="text"]:not(:first)').each(function(i) { if($.trim($(this).val()) == '') { $(this).closest('.answer-item').hide(); } if ($('#question'+qID+' .answer-item:visible').length > 1) { $('div#removeButton'+qID).show(); } }); } // Call the function with a question ID varLengthArray({QID}); }); </script>