Welcome to the LimeSurvey Community Forum

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

array/multiple answers + filtered colum

  • simonedebattisti
  • simonedebattisti's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago #210084 by simonedebattisti
array/multiple answers + filtered colum was created by simonedebattisti
hallo,

I have been trying several and several options and searching around in the forum finding only partial answer to this articulated issue that, up to know , i have resolved with a sub-optimal way, creating a single answer array.

my real need is to create an array (items on the rows and brands on the columns) where:

1. for each item a multiple number of brands can be selected. the only single should be "none of these brands" or "don't know"

2. furthermore the brand list (so the number of columns) should be "reduced" depending on the brand awareness question which come before.

I have found that it is possible to filter the lines but not the columns, up to now.

so i have to renounce both to the multiple answer and to the filtering with the double problem of
1. having somebody who select a brand that he/she said not to know
2. having only one answer per line (items) instead of multiple

can you help me out of this which seems to be a very normal way to make a survey answer scheme. thanks
Simone
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago #210086 by Joffm
Replied by Joffm on topic array/multiple answers + filtered colum
Hi, Simone,
you did not mention your LimeSurvey version

So, to filter the brands, you can use the plugin "hideEmptyColumn" for versions 2.50/2.73 and 3.x
gitlab.com/SondagesPro/QuestionSettingsType/hideEmptyColumn

And there is a workaround to set the last column exclusive
Code:
<script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
    // Call the exclude function using question ID
    excludeOpt({QID});
  });
 
  // A function to make the last option in each array row exclusive
  function excludeOpt (qID) {
 
    var thisQuestion = $('#question'+qID)
 
    // Add some classes to the checkbox cells
    $('td.checkbox-item', thisQuestion).addClass('normal-item');
    $('tr.subquestion-list', thisQuestion).each(function(i) {
      $('.normal-item:last', this).removeClass('normal-item').addClass('exlusive-item')
    });
 
    // A listener on the checkboxes
    $('input[type="checkbox"]', thisQuestion).on('change', function (event) {
      handleExclusive($(this).closest('td'));
    });
 
    function handleExclusive(thisCell) {
 
      var thisRow = $(thisCell).closest('tr');
 
      // Uncheck the appropriate boxes in a row
      if ($(thisCell).hasClass('normal-item')) {
        $('.exlusive-item input[type="checkbox"]', thisRow).prop('checked', false);
      }
      else {
        $('.normal-item input[type="checkbox"]', thisRow).prop('checked', false);
      }
 
      // Check conditions (relevance)
      $('td.checkbox-item', thisRow).each(function(i) {
        var thisValue = '';
        if($('input[type="checkbox"]', this).is(':checked')) {
          thisValue = 1;
        }
        var thisSGQA = $('input[type="checkbox"]', this).attr('id').replace(/cbox_/, '');
 
        $('input[type="hidden"]', this).attr('value', thisValue);
        fixnum_checkconditions(thisValue, thisSGQA, 'hidden');
      });
    }
  }
</script>





Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • simonedebattisti
  • simonedebattisti's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago #210088 by simonedebattisti
Replied by simonedebattisti on topic array/multiple answers + filtered colum
thanks. I am using: Version 3.17.3+190429

but i don't program but use the "software" online that automatically create the survey.

is that too bad? ;-(
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago #210091 by Joffm
Replied by Joffm on topic array/multiple answers + filtered colum
Hi,
anybody uses the software "online".
What is: "that automatically create the survey"?

Where is it hosted?

If you do not have the necessary rights (upload plugins), bad luck.
But the javascript you might be able to insert. If not, bad luck again.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • simonedebattisti
  • simonedebattisti's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago #210092 by simonedebattisti
Replied by simonedebattisti on topic array/multiple answers + filtered colum
I think is the company server, but don't know I am not the it man, I am just asked to program the survey.

i check about plugins etc. thanks

i think script is programmable, i am not expert tough, so something new to learn. good
s
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
4 years 1 month ago #210093 by DenisChenu
Replied by DenisChenu on topic array/multiple answers + filtered colum
Without plugins : gitlab.com/SondagesPro/QuestionSettingsT...s/hideemptycolumn.js

Add this function to custom.js can work

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.
The following user(s) said Thank You: Joffm
The topic has been locked.
  • simonedebattisti
  • simonedebattisti's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago #210094 by simonedebattisti
Replied by simonedebattisti on topic array/multiple answers + filtered colum
super thanks!

this is the way
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose