Welcome to the LimeSurvey Community Forum

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

Random group of questions with style="display: none;"

  • teracomp
  • teracomp's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
6 years 9 months ago #156767 by teracomp
I have a long survey, 250 questions. The first 125 questions are 25 groups for ranking 5 each. That works fine.
The next five sections include 25 questions each with a Randomization Group Name set to 'practices'

If the user selects Resume Later the items are saved, but when they return, most of the questions are not visible. For some reason, most questions have a style set to "display: none;" (see attached)

The users CANNOT complete the survey because there are mandatory questions that are hidden from their view.

Have I missed a setting somewhere??

This survey is live and on a short-runtime since it's used for validation purposes. Greatly appreciate a prompt response.

Thanks!
dave

Dave Phillips
The topic has been locked.
  • teracomp
  • teracomp's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
6 years 9 months ago #156790 by teracomp
Two of my subject matter experts have abandoned this survey because of this bug.

Please tell me I've made a mistake and point me in the right direction.

dp

Dave Phillips
The topic has been locked.
  • ollehar
  • ollehar's Avatar
  • Offline
  • LimeSurvey GmbH Employee
  • LimeSurvey GmbH Employee
More
6 years 9 months ago - 6 years 9 months ago #156799 by ollehar
Randomization with "Resume later" is basically useless, since the randomization will be renewed on each visit. This is fixed in LS 3.0 (not yet released), where the random seed is saved together with the participant response, this way preserving the random order between visits.
Last edit: 6 years 9 months ago by ollehar.
The following user(s) said Thank You: teracomp
The topic has been locked.
  • teracomp
  • teracomp's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
6 years 9 months ago #156800 by teracomp
So, I'm stuck.

My plan B is to stop the survey, randomize my 125 items externally, then import them in groups and eliminate the Randomization Group label.

Dave Phillips
The topic has been locked.
  • ollehar
  • ollehar's Avatar
  • Offline
  • LimeSurvey GmbH Employee
  • LimeSurvey GmbH Employee
More
6 years 9 months ago #156802 by ollehar
You can also use JavaScript to hide questions randomly.
The topic has been locked.
  • teracomp
  • teracomp's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
6 years 9 months ago #156804 by teracomp
I really appreciate your thoughts on this. I have several LS surveys published and I'm really hoping to use it more extensively. This kind of issue makes those I'm supporting question the use of LS and puts me in a tight spot. And, of course, I didn't know Resume Later with randomized groups would cause such a problem.

I'm thinking that Resume Later will work by hiding those questions which are already answered, yes? As long as they're not randomly placed within the group, this should work.

I haven't implemented "Plan B" but intend to do that in the next hour or so.

Adding Javascript to each of the 125 questions doesn't seem like the best approach, though I'm guessing I could do this on the backend database in the question meta table somehow (seems risky). My goal is to make sure the items are not in sequential order as they are now (just to make admin easier).

Dave Phillips
The topic has been locked.
  • ollehar
  • ollehar's Avatar
  • Offline
  • LimeSurvey GmbH Employee
  • LimeSurvey GmbH Employee
More
6 years 9 months ago #156805 by ollehar
You would add JavaScript to the groups, not the questions (assuming your survey is organized by groups). Still, it might take some work to get it right.
The topic has been locked.
  • teracomp
  • teracomp's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
6 years 9 months ago #156806 by teracomp
Ah yes, that makes more sense...I would need to find style="display: none;" and change that to block. This would reveal questions already answered, but since this is a validation survey, that might be ok.

I'll give that a try first. Thanks for the correction to my early morning thinking!

Dave Phillips
The topic has been locked.
  • teracomp
  • teracomp's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
6 years 9 months ago #156813 by teracomp
Any feedback on the jQuery code would be appreciated.

What I want to do with the jQuery is grab all of the question divs and remove style="display: none;"

The div ids start with "question" so this should find all "question" divs and remove each style attribute

In each of the 5 group's source, I need to add:

<script type="text/javascript">
$( document ).ready(function() {
$("div[id^='question']").removeAttr("style");
});
</script>

With the style removed, the questions will then be displayed.

Please let me know if I'm thinking straight. This seems like the right idea.

Dave Phillips
The topic has been locked.
  • teracomp
  • teracomp's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
6 years 9 months ago #156815 by teracomp
While this does show all of the divs, it is NOT the solution. Every time I select NEXT for a group, I get an error that all questions have not been answered (I assume this is because of RAND), the answers are lost and the page reloads with a bunch of unanswered questions.

I'm going to have to go back to the original idea of randomizing the questions and loading the groups with sets of randomized questions.

Looking forward to Version 3.0!

Dave Phillips
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 9 months ago #156832 by DenisChenu
To show one group in 5 : you can use a Equation question type with.
{if(is_empty(self.NAOK),alea(1,5),self.NAOK)}

Named 'groupChoose' and a condition on each group : groupChoose==1 etc …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose