- Posts: 18
- Thank you received: 1
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var qID = 1; // You have to adapt to your quetion number $('#question'+qID+' input[type="text"]').autocomplete({ minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated source: ["John","Bill","Edward","Marvin","Colin"] }); }); </script>
<style type="text/css">.form-horizontal .control-label { margin-bottom: 0; padding-top: 11px; text-align: left; } .ui-autocomplete { width:300px !important; } </style>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#question{QID} input[type="text"]').autocomplete({ minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated source: ["John Lennon","John Doe","Bill Gates","Billy Idol","Bill Clinton"] }); }); </script>
In my array there are about 80 different names.1. Plain text input (the easiest, suitable for small lists or arrays).
2. Input from CSV file (a little trickier, requires several files. Suitable for larger lists and arrays).
3. Input from a MySQL database (trickiest, but also the most versatile and secure).
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#question{QID} input[type="text"]').autocomplete({ minLength: 2, // This line is optional, signifies number of keystrokes before autocomplete is initiated source: ["John Lennon","John Doe","Bill Gates","Billy Idol","Bill Clinton"], change: function(event, ui) { $(this).trigger('keyup'); } }); }); </script>
unique(self)
{if(unique(self), '', 'Answers must be unique!')}