Welcome to the LimeSurvey Community Forum

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

Implementing a menu structure

  • limerboy
  • limerboy's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 7 months ago #188537 by limerboy
Implementing a menu structure was created by limerboy
Hey guys,


we've been using conditionals to build a "menu" for our survey (see attached .lss). Our goal is to use the survey as an input tool for observations during "potential analysis" (i simply translated the german term) with students. We want to use tablets for this and each observer has to enter data for up to six students. I know that this is not the original use case for lime survey, but it should work nevertheless, except for the problem below:

We are very happy with our menu structure (see attached .lss) but unfortunately we noticed, that because it's based on conditionals, only the responses for the last selected student are saved. We would love to keep this simple menu structure and our survey is quite long therefore using a different system would require a lot of work.

We've been considering two possible solutions for our problem:

(1) The most simple solution we thought about is to save the entered responses on every button click in the selection menu. I've been trying to get this to work. According to this thread it shouldn't be too hard to do. But I did not suceed until now.

(2) My second idea is to create questions that mirror the inputs of the questions hidden by conditionals and hide them via javascript or css so that their responses are being saved. Unfortunately I wasn't able to implement the mirroring aspect, although I think it shouldn't be hard. Not so good about this would be, that from my understanding the answers would be in the database, but after coming to a page they wouldn't be visible within the survey.

(3) A completely different approach would be to throw out the conditionals and create the same functionality with javascript or css. But I have no idea how to do this.

File Attachment:

File Name: list-radio-menu.lss
File Size:34 KB


Can anyone help me with the implementation of any of these ideas? I'm also open for completely different approaches, but as I said, we fell in love the simplicity of the menu.

Regards limerboy
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188547 by holch
Replied by holch on topic Implementing a menu structure
In my opinion the whole apprach doesn't make any sense.

Why not giving token to each respondent and increase the number of uses left? Then they can fill in a survey per student.

I can't imagine how the current workflow is. Why would you first ask the names of everyone, then the ratings of everyone, then see the report of everyone?

I would make it as one streamlined process: Put name for 1 student, put evaluation of this student, see report, finish. Start new survey for student 2, 3, 4, etc.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188548 by Joffm
Replied by Joffm on topic Implementing a menu structure
The idea is to rate several persons on some dimensions at the same time, so being able to hop from one person to another.

@holch: there is a long thread about it in the German part, one month ago.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: holch, limerboy
The topic has been locked.
  • limerboy
  • limerboy's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 7 months ago #188621 by limerboy
Replied by limerboy on topic Implementing a menu structure
Dear holch and Joffm,

thank you very much for your replies in the german thread and also here. We'd really like to keep the menu structure, unless it turns out that it's impossible.

The idea is to rate several persons on some dimensions at the same time, so being able to hop from one person to another.

That's it!

The menu for hopping around is based on a list (radio) question with button layout. When clicking a button the questions for the corresponding participant are displayed.

While staying on the same page this works great. However as soon as one continues with the survey, only the responses for the last selected participant (list radio entry) are being saved (this is expected behavior of course). I'm looking for a workaround which saves all of the inputs made.

I think the best solution would be to save the current participants data whenever another participant (list radio button) is selected. I think this could be done by setting an onclick save-action for the list radio button via javascript.

Can some javascript expert tell me if this is indeed possible? And if so, how to implement it?

tpartner? DenisChenu?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188626 by tpartner
Replied by tpartner on topic Implementing a menu structure
You could remove the relevance in the arrays that is based on the list-radio question and place something like this in the source of the list-radio question:

Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).on('ready pjax:scriptcomplete',function(){
 
    var thisQuestion = $('#question{QID}');
    var arrayQuestions = $(thisQuestion).nextAll('.question-container.array-flexible-row');
 
    // Loop through the answer items
    $('.answers-list > div.bootstrap-buttons-div', thisQuestion).each(function(i) {
      var thisRow = $(this);
 
      // Hide button with no text
      if($.trim($('label:eq(0)', thisRow).text()) == '') {
        $(thisRow).hide();
      }
 
      var thisIndex = $(thisRow).index();
      var thisArrayQuestion = $(thisRow).closest('.question-container.list-radio').nextAll('.question-container.array-flexible-row:eq('+thisIndex+')');
 
      // Hide the array questions
      if($('input:radio:checked', thisRow).length == 0) {
        $(thisArrayQuestion).hide();
      }
 
      // Listener on the radios
      $('.button-item', thisRow).on('click', function(e) {
        $(arrayQuestions).not(thisArrayQuestion).hide();
        $(thisArrayQuestion).fadeIn(300);
      });
 
    });
  });
</script>

Sample survey attached:

File Attachment:

File Name: limesurvey...8184.lss
File Size:36 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.

Lime-years ahead

Online-surveys for every purse and purpose