Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

How to hide Inner Answer for Dropdown List

  • rajkumar_dms
  • rajkumar_dms's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
1 day 22 hours ago #266859 by rajkumar_dms
How to hide Inner Answer for Dropdown List was created by rajkumar_dms
Please help us help you and fill where relevant:
LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey Cloud:
Survey theme/template:Fruty twentythree
==================
Hi All,

I had made both question type radio & check box with dropdown but i need search option for both and don't show the inner list  when search any 1st 1 to 2 letter then data related option will be visible

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 day 20 hours ago #266863 by tpartner
Replied by tpartner on topic How to hide Inner Answer for Dropdown List
It requires JavaScript development.

Some inspiration - forums.limesurvey.org/forum/can-i-do-thi...lete?start=24#211354

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • rajkumar_dms
  • rajkumar_dms's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
1 day 17 hours ago #266872 by rajkumar_dms
Replied by rajkumar_dms on topic How to hide Inner Answer for Dropdown List
Uploaded the that question themes but i need a modification in it when i click on search bar then all list shown below but i need not show the list until i type the related keyword for the same

Is it possible in it

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 day 17 hours ago #266873 by Joffm
Replied by Joffm on topic How to hide Inner Answer for Dropdown List
Search the forum for "autocomplete".
There are many examples.

Or go to the "workaround (javascript)" section of the manual.

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 day 2 hours ago #266876 by tpartner
Replied by tpartner on topic How to hide Inner Answer for Dropdown List

Uploaded the that question themes but i need a modification in it when i click on search bar then all list shown below but i need not show the list until i type the related keyword for the same

Is it possible in it
Look at the select2 minimumInputLength option - select2.org/configuration/options-api

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • rajkumar_dms
  • rajkumar_dms's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
16 hours 48 minutes ago #266889 by rajkumar_dms
Replied by rajkumar_dms on topic How to hide Inner Answer for Dropdown List
i search that and fond many example for the same but they not meet my need when i click on search box then all shown below but my need is until any word type the no list will be shown if type any word then that word related text will be shown

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
14 hours 54 minutes ago - 14 hours 31 minutes ago #266892 by Joffm
Replied by Joffm on topic How to hide Inner Answer for Dropdown List
That was your first requirement

i need search option for both and don't show the inner list  when search any 1st 1 to 2 letter then data related option will be visible

Remember: One or two letters

Now you write

if type any word then that word related text will be shown

Now you talk about "words". So you want to type a word first?

Well, if you really searched the forum or the workaround section you found this to insert an autocomplete in a question of type "short text".
[url][/url]

As this workaround is a few years old, we have to insert the "jquery-ui" files. Either you download them and add them to your theme or you insert from cdn
Code:
<link href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" />
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>


Then the script itself - really short
Code:
$(document).on('ready pjax:complete',function() {
    $('#question{QID} input[type="text"]').autocomplete({
      minLength: 5,
      source: [
          "Peter Gunn",
          "Alfred Miller",
          "Peter Bond",
          "Alice Miller",
          "Peter Stuyvesant",
          "Carol King"
       ]
    });
  });
</script>

And here we get a result only after at least 5 characters are entered (minlength)
 
 
 

This is fine up to about 300 elements.

If there are many more - I talk about thousands and thousands - you may use the solution with the csv file.
Here you need additionally this script
Code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-csv/1.0.11/jquery.csv.min.js"></script>


and the script itself is changed to
Code:
<script type="text/javascript" charset="utf-8">
  $(document).on('ready pjax:complete',function() {
    
    var url = "https://www.myserver.de/myFolder/myFile.csv"; // or the "files" folder of the survey
    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({
           minLength: 2,
           source: Names
      });
    });
  });
</script>


So it's up to you to set the amount of characters before the autocomplete is fired.

But nevertheless there are other options.
Have a look at the library "easy-autocomplete" (just google it) or Denis' autocomplete plugin
[url] gitlab.com/SondagesPro/QuestionSettingsType/autoComplete [/url]


But as long as you seem to be unable to show a realistic example of your wishes it is really hard to help you.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
  • Last edit: 14 hours 31 minutes ago by Joffm.

    Please Log in to join the conversation.

    • DenisChenu
    • DenisChenu's Avatar
    • Offline
    • LimeSurvey Community Team & Official Partner
    • LimeSurvey Community Team & Official Partner
    More
    3 hours 58 minutes ago #266899 by DenisChenu
    Replied by DenisChenu on topic How to hide Inner Answer for Dropdown List

    But nevertheless there are other options.
    Have a look at the library "easy-autocomplete" (just google it) or Denis' autocomplete plugin
    [url] gitlab.com/SondagesPro/QuestionSettingsType/autoComplete [/url]

     
    In my opinion : the best one today are gitlab.com/SondagesPro/QuestionSettingsT...tQuestionByResponses : more quick (read by DB), you can easily manage the list via admin GUI, etc …

    Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
    I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
    I don't answer to private message.

    Please Log in to join the conversation.

    Moderators: holchtpartner

    Lime-years ahead

    Online-surveys for every purse and purpose