Welcome to the LimeSurvey Community Forum

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

Array - Text (Col1), Text (Col2), Slider(Col3)

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 weeks ago #226681 by Joffm
Of course, I saw that you use different files depending on a previous answer.
Do it here the same way  using ExpressionScript/Manger.
 

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 weeks ago - 3 years 2 weeks ago #226682 by Joffm
And, to add:
As you might have seen in the workaround section of the manual there are three ways to include the objects:
  1. array
  2. csv file
    to make it dependend on a previous question (N1), e.g. 
    var url = "/upload/surveys/{SID}/files/names{N1}.csv";
  3. querying a database.

This last also might be interesting for your approach.

[url] www.limesurvey.org/manual/Workarounds:_M...r_LimeSurvey_2.05.2B [/url]

Joffm

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

Please Log in to join the conversation.

  • 2022needhelp
  • 2022needhelp's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 weeks 2 days ago #269733 by 2022needhelp
Replied by 2022needhelp on topic Array - Text (Col1), Text (Col2), Slider(Col3)
Thanks again for the script! It's working very well in our surveys.

I now have a follow-up question. In my current survey, I have a table with six columns on the X-scale (two text fields, two dropdowns, and two sliders). Everything is functioning as expected, but the sliders extend beyond the column width, and I can't seem to adjust their length.

Would it be possible to fix this by modifying your script? I would really appreciate your support. Thanks!

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 weeks 2 days ago - 4 weeks 2 days ago #269736 by Joffm
Hi,
this thread is nearly 3 years old.
So, at least you should have provided a lss export of this/these relevant question/s.

Because I do not see an issue
 
Joffm 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 4 weeks 2 days ago by Joffm.

Please Log in to join the conversation.

  • 2022needhelp
  • 2022needhelp's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 weeks 1 day ago - 4 weeks 1 day ago #269742 by 2022needhelp
Replied by 2022needhelp on topic Array - Text (Col1), Text (Col2), Slider(Col3)
Hi,

yes sure. Here is the lsg export of the question. Thank you for the help.

 
Last edit: 4 weeks 1 day ago by 2022needhelp.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 weeks 1 day ago #269746 by Joffm
Neither lsq nor lsg export, only lss exports, please.

at least you should have provided a lss export

Copy the survey, remove everything not related to your problem, send the lss exoort of this relevant part.

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

Please Log in to join the conversation.

  • 2022needhelp
  • 2022needhelp's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 weeks 1 day ago - 4 weeks 1 day ago #269749 by 2022needhelp
Replied by 2022needhelp on topic Array - Text (Col1), Text (Col2), Slider(Col3)
All right, here is the export as lss.
Last edit: 4 weeks 1 day ago by 2022needhelp.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 weeks 1 day ago #269751 by Joffm
Hi,
first some hints.
1. It's not necessary to enter the "dropdown"-script several times.
Code:
        // Insert selects
        $('.answer-item.answer_cell_3', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
                                                    <option value="">Please select...</option>\
                                                    <option value="1">Option1</option>\
                                                    <option value="2">Option2</option>\
                                                    <option value="3">Option3</option>\
                                                    <option value="4">Option4</option>\
                                                </select>');
        $('.answer-item.answer_cell_4', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
                                                    <option value="">Please select...</option>\
                                                    <option value="1">Value1</option>\
                                                    <option value="2">Value2</option>\
                                                    <option value="3">Value3</option>\
                                                    <option value="4">Value4</option>\
                                                    <option value="5">Value5</option>\
                                                    <option value="6">None of the above</option>\
                                                </select>');
 
is sufficient.

2. Do you really want to store the text of the answer options. 
To store the values change this
Code:
     // Returning to page
    $('.with-select input:text', thisQuestion).each(function(i) {
      var thisCell = $(this).closest('.answer-item');
      var inputText = $.trim($(this).val());
      $('select.inserted-select', thisCell).val(inputText);
    });

to
Code:
    // Returning to page
    $('.with-select input:text', thisQuestion).each(function(i) {
      var thisCell = $(this).closest('.answer-item');
      var inputText = $.trim($(this).val());
      var selectval = $('select.inserted-select option', thisCell).filter(function () { return $(this).html() == inputText; }).val();
      $('select.inserted-select', thisCell).val(selectval);
    });

3. In my opinion it is better to set the column of the slider in the variable
Code:
        // The column to receive the sliders
        var sliderColumn = 5;
        ...
        var sliderColumn = 6;
 
instead of setting it always to "1" and adding an offset at several places.

Well, now your question
1. You did not set any slider width. If you set the label width to "hidden" and the slider width to 100% the next issue occurs.
2. Because the column is rather small the bootstrap media query is used which sets the width of the slider container to 66.6%.
You have to adjust this.
Code:
@media (min-width: 768px) {
  .col-md-8 {
    flex: 0 0 auto;
    flex-grow: 0;
    width: 100% !important;
  }

And here the result (styling if the slider is a relict of an old survey of mine)
 

And your lss back (I removed the "autocomplete" part.)
BTW: Why didn't you use one of the several "autocomplete" examples of the forum?
 

File Attachment:

File Name: limesurvey...22_J.lss
File Size:83 KB


Joffm



 

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

Please Log in to join the conversation.

  • 2022needhelp
  • 2022needhelp's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 weeks 1 day ago #269756 by 2022needhelp
Replied by 2022needhelp on topic Array - Text (Col1), Text (Col2), Slider(Col3)
Many thanks for the quick help. It works perfectly. Thanks also for the tip with the dropdown script!

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose