Welcome to the LimeSurvey Community Forum

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

Display Answers from 10 Point Array in Following Question

  • Joffm
  • Joffm's Avatar Topic Author
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 6 days ago #144439 by Joffm
Hi, Antonimo,

i try to create a sample for you. But not today.

In the meantime read this thread, especially Tony's last answer.


Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • Joffm
  • Joffm's Avatar Topic Author
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 6 days ago #144452 by Joffm
Sorry, Antinimo,
I did not attach the thread's link.
www.limesurvey.org/forum/can-i-do-this-w...on-previous-question

There are some sample surveys or snippets attached (Urbana, Tony).
And please read my remarks to an approach like yours.

Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 6 days ago #144472 by tpartner
Assuming the survey is in group-by-group mode, here is an example of how to use hidden multiple-choice questions to filter the ranking question.

1) Ensure that the arrays have unique sub-question codes (no two array are the same).

2) Directly after each array, insert a multiple-choice question with exactly the same sub-questions as the array.

3) Ensure that answer codes for the ranking question match those in the arrays.

4) Set the array filter in the ranking question to the IDs if the multiple-choice questions.

5) Set up your survey to use JavaScript and insert the following script into the source of each array. It will hide the following multiple-choice and toggle corresponding check-boxes depending on if a row is answered >= 7. The LimeSurvey array filter takes care of the rest.

Code:
<script type="text/javascript" charset="utf-8">  
 
  $(document).ready(function() {
 
    // Identify the questions
    var thisQuestion = $('#question{QID}');
    var thisQuestionID = '{QID}';
    var qHidden = $(thisQuestion).nextAll('.multiple-opt:eq(0)');
    var qHiddenID = $(qHidden).attr('id').split('question')[1];
 
    // Hide the checkbox question
    qHidden.css({
      'position': 'absolute',
      'left': '-9999em',
      'top': '-9999em'
    });
 
    // Listener on the radios 
    $('input.radio', thisQuestion).on('click', function(e) {
      var thisSQCode = $(this).attr('name').split('X'+thisQuestionID)[1];
      var hiddenCheckbox = $('input.checkbox[id$="X'+qHiddenID+thisSQCode+'"]');
 
      // Toggle the hidden checkbox
      if($(this).val() > 6) {
        hiddenCheckbox.prop('checked', true);
        hiddenCheckbox.nextAll('input:hidden').val('Y');
      }
      else {
        hiddenCheckbox.prop('checked', false);
        hiddenCheckbox.nextAll('input:hidden').val('');
      }
 
      // Fire Expression Manager
      checkconditions(hiddenCheckbox.value, hiddenCheckbox.name, hiddenCheckbox.type);
    });
    });
</script>

Sample survey attached:

File Attachment:

File Name: limesurvey...-4-5.lss
File Size:29 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose