- Posts: 35
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
Else : maybe try with this version
gitlab.com/SondagesPro/QuestionSettingsT...5c9f889531eed437ee7b
It was done in 2.73.
MaybeBusyBonsai wrote: But I can tweak what you give me with this ( github.com/devbridge/jQuery-Autocomplete...tings-local-and-ajax ) so it gives me my exact need, right?
<script> $(document).ready(function() { var qID = {QID}; var orgs = ["Hello World", "Test"] var currentVal = $('input.text', '#question' + qID).val(); $('#question'+qID+' input[type="text"]').autocomplete({ minLength: 2, source: orgs, change: function(event, ui) { if(!ui.item){ // Nothing matched in the data array so clear the value $(this).val(''); } currentVal = $(this).val(); }, response: function(event, ui) { if($(ui.content).length == 0){ // Nothing found in the data array so revert to last value $(this).val(currentVal); alert("Koala"); setTimeout(function() { if(currentVal != '') { $('input.text', '#question' + qID).autocomplete('search'); } }, 200); } else { currentVal = $(this).val(); } } }).on('keyup', function(e) { if($.trim($(this).val()) == '') { $(this).val(''); currentVal = $(this).val(); } }); }); </script> <style type="text/css">.form-horizontal .control-label { margin-bottom: 0; padding-top: 11px; text-align: left; } .ui-autocomplete { width: 400px !important; } </style>