Welcome to the LimeSurvey Community Forum

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

Autofill to find data from 10 sets of dropdown choices

  • hakabe
  • hakabe's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 2 months ago #225229 by hakabe
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.2.14+220214
[Own server or LimeSurvey hosting: Own server
Survey theme/template: Fruity
==================
Hi,

I have a question group which consists set of 14 questions which are dropdown menus and where users can choose the right code. For instance, in A section I have text similar to "A01 Pain, Common / In many places". As you can imagine, it's time consuming to find the right one even the dropdown menus are categorized alphabetically.

What I'm to achieve is to have a simple text field on top all of these dropdown menus, where the autofill would fetch data of all of these dropdown question ID's (or a datafile). So when the user starts typing two letters A0 or pain, the user will get an result where the "A01 Pain, Common / In many places" is surely one of the results.

So far I've tried using the manual [url] www.limesurvey.org/manual/Workarounds:_M...tc..29_in_LimeSurvey [/url] but it seems I'm not even able to get the autofill to print out basic example code.
Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).ready(function() {
 
    var q1ID = 'QQ';
 
    var states = "Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming".split(',');
 
    $('#question'+q1ID+' input.text').autocomplete({
      source: states
    });
 
  });
 
</script>

So my question is:
1. Is the manual up to date for v. 5? For instance, it suggest to modify templates.css (Add the following styles to the end of your 'template.css' file) which cannot be found on the files. I've added the custom code to custom.css.
2. Which text field should I use when using autofill? Short free text?
3. Is there any live example script (except jqueryui.com/autocomplete/ ) that actually is running on Limesurvey?
4. How do fetch data from 14 drop down menus? Adding more vars to question ID's like var q1ID var q2ID and #question'+q1ID+'+q2ID+' input.text'?

Javascript works as I'm getting the "Test!" -popup. I'm using newest Chrome and Edge.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #225238 by Joffm
Hi,
this workaround is very old.
In the meantime - since version 2.50 - LimeSurvey is not based on JQueryUI anymore, but on bootstrap.
Therefore you have to include these libraries into your script.

And again with integration of ExpressionManager/Script it is not necessary anymore to insert the question ID manually. This is done bey the placeholder {QID}

So, with all this you get this code
Code:
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
 
<script type="text/javascript" charset="utf-8"> 
  $(document).on('ready pjax:complete',function() {
 
    var states = "Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware, District of Columbia,Florida,Georgia,Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky, Louisiana,Maine,Montana,Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York, North Carolina,North Dakota,Ohio,Oklahoma,Oregon,Maryland,Massachusetts,Michigan, Minnesota,Mississippi,Missouri,Pennsylvania,Rhode Island,South Carolina,South Dakota, Tennessee,Texas,Utah,Vermont,Virginia,Washington,West Virginia,Wisconsin,Wyoming".split(','); 
 
    $('#question{QID} input[type=text]').autocomplete({
      minlength:2,
      source: states
    }); 
  });
  </script>



But you also should have a look at the question theme "Searchable Drop-down" from Tony Partner (tpartner)
[url] github.com/tpartner/LimeSurvey-Searchable-Dropdown [/url]

 

Joffm

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: hakabe

Please Log in to join the conversation.

  • hakabe
  • hakabe's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 2 months ago #225282 by hakabe
Huge thanks to you!

The script you gave worked.

Unfortunately the "Searchable Drop-down from Tony Partner (tpartner)" is not compatible with the version 5. There's a request for make it compatible with version 5 ( github.com/tpartner/LimeSurvey-Searchable-Dropdown/issues/1 ), but the author hasn't responded.

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
3 years 2 months ago #225283 by DenisChenu

Unfortunately the "Searchable Drop-down from Tony Partner (tpartner)" is not compatible with the version 5. There's a request for make it compatible with version 5 ( github.com/tpartner/LimeSurvey-Searchable-Dropdown/issues/1 ), but the author hasn't responded.
 
Maybe he can create an offer : partnersurveys.com/services
 

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.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #225286 by Joffm
Hi,
did you upload to the correct folder?
"/upload/themes/question"
 

I do not see an issue in 5.2.9. 
 

Anyway: You still have the option to use the "autofill".

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

  • hakabe
  • hakabe's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 2 months ago #225287 by hakabe
Yes I did, but it didn't show up until I changed the version on XML (or something else happened during that time).

I tried using the searchable dropdown importing around 1000-1500 questions using load labelset from my set of group questions which were divided to 15 different dropdowns, but after adding 10 labelsets (around 700-800 questions) or so all I ended up was seeing the loading pattern on admin interface.

I tried tuning the php.ini (max_input_vars, execution time, limits etc) and nginx configurations without any success.

So I need to go back to my initial problem, "how to fetch data from 14 drop down menus?". Anyways this is quite joyful as I'm learning on the way :)

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #225289 by Joffm
Okay, we do not see your deign. So you send a lss export.

But I still do not quite understand your idea?
I understand:
You have 14 drop-downs with some kinds of diseases or whatever.
.
But you do not want the participant to have to go through all of the dropdowns to find his disease.

Solutions:
Instead of the dropdowns use 14 autofill questions. Take the data from a csv file. Really, really fast.

The crucial point for me is: What are the dropdowns needed for after the participant "found" his disease and it is in your data?
Or do you talk about something like "multiple drop-downs"?

Joffm


​​​​​​​
 

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

Please Log in to join the conversation.

  • hakabe
  • hakabe's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 2 months ago - 3 years 2 months ago #225291 by hakabe
The idea was, that the nurse can choose multiple ICPC-2 diagnoses, but one ICPC-2 code is enough. The old questionary form was provided me and the dataset was based on these 14 grouped questions and they were sorted alphabetically.

And yes, I think this approach is time consuming for experinced user to browse dropdown menus. However, the dropdown menus need to exist as sometimes a nurse may need to choose the closest one, yet not exactly the right ICPC-2 code for a particular symptom or disease.

-Most convenient approach for me would be an autocomplete textfield as a 1st question. This text field would exist at the same questionary group as the first question OR user may choose from the dropdown menus.
-Autocomplete textfield would fetch data from the dropdown Q2A01-99,Q2B01-99, Q2C0... etc fields
-Add tags/keywords/hints that will not show in results(not sure if even supported)

But for now, I need to implement a working solution, which is the 14 dropdown menus with autofills. There's no ready ICPC-2 CSV for my language (Finnish), but I guess I'll be poking that next.

Thanks again for your help!
Last edit: 3 years 2 months ago by hakabe.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #225296 by Joffm
Well, if you think you need both, implement both.
Then you will get codes in two different columns of the database, but you may merge by an equation afterwards.

Joffm

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

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago - 3 years 2 months ago #225300 by Joffm
And you can have both, everything in one question.
Well, not really one, these are several arrays, merged by css "no-question" and "no-bottom"

In the first column I inserted the autofill, in the second a drop-down.
All these scripts are several times here in the forum. 

I took this classification from a German page.
We do not know, what you want to display.







If this is something you think you could use, I create a sample survey for you.

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 2 months ago by Joffm.

Please Log in to join the conversation.

  • hakabe
  • hakabe's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 2 months ago - 3 years 2 months ago #225301 by hakabe
Joffm: Thank you for your dedication and help!

The basic structure of the survey is divided group-by-group (not able to share it as I don't know if I'm allowed to).

Page 1:
1. State location or 2. other location throught the Finland (which is a big list).

I think by defining all the locations in section 2., it makes the analysis look really stupid and unable to print graph (is there a way to only show results and hide empty (0 answers) cities?
3. Age

Page 2:
4. Groups 4-19 ICPC codes (so 15 dropdowns actually). Autocomplete using dropdown menus are working, but I still want the autocomplete text field as a 1st optional question. I'm planning the autocomplete fill textfield on top of these. I'm going to try trying search.php method that prints JSON data ( www.tutorialspoint.com/jqueryui/jqueryui_autocomplete.htm ). Same effort would be using CSV.

Questions on pages 3-5 are working as intended.
Last edit: 3 years 2 months ago by hakabe.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #225303 by Joffm
Hi,
if we ask for a lss export it usually should be your prototype where you develop the structure.
Before you start to insert your real texts etc.

But even without a drawing of your idea I'll show you another solution.
No matter how you insert the options into the autofill field; use your preferred one. While in my opinion this "search.php" option is a bit too sophisticated. There will be only about 1000 options, or? 

But let's show something.

At the beginning you have the general "autofill" question
 

If the respondent finds a code this will be inserted into the drop-down field
 



If he doesn't find a code and clicks "I did not find" (this is done bey the plugin "checkBoxFor Text")
the dropdown section is displayed.


To display it like this there is only a little bit of css necessary.

Here I still used array(text) for the dropdowns.
You also can use "multiple numerical input"

Joffm

If it suits you, I'll send a sample file.

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

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose