Welcome to the LimeSurvey Community Forum

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

Have access to information about all question groups

  • oswaldp
  • oswaldp's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 6 months ago #220266 by oswaldp
Hello,

I've been tinkering with LimeSurvey for a while now and after looking everywhere I can't figure out if what I'm trying to do is possible.

We have a survey set up in group mode where user can use the navigator to go from one group of questions to the next/previous one and I was tasked with "creating" a theme for this survey.
One of the requirements for this theme would be to have a user friendly navigation. This implies two things to implement:
  • On the first page: Display a "table of content". This table of content should be a set of tiles each representing a specific question group. Each tile should be able to display: The name of the group, the title of each questions it contains as well as what questions have already been answered. The goal here is to be able to show the user what questions he'll have to answer as well as his current progress.
  • During the survey: Display a progress bar that also shows the different question groups (can be clicked to navigate to them) with different colors depending on if all the questions of the group have been answered or not. Here again, the goals would be to allow navigation through question groups and give the user a summary of his progress.
My problem is that it seems the variable aSurveyInfo doesn't have the information loaded for all groups on the first page (I can actually get the title of every group through aSurveyInfo.aQuestionIndex.items, but not the detailed info about the questions). In the same way, if I try using ExpressionScript to reference later questions, their value appears blank, until I visit their respective page and come back to my table of content page.

Would love if anyone could help me with this as I've been stuck on this for too long now 
Thank you!

PS: LimeSurvey 3.27.17, build 210911 

Please Log in to join the conversation.

  • upstacksolutions
  • upstacksolutions's Avatar
  • Offline
  • Junior Member
  • Junior Member
More
2 years 1 week ago #226300 by upstacksolutions
Replied by upstacksolutions on topic Have access to information about all question groups
Could you do this?

Please Log in to join the conversation.

  • oswaldp
  • oswaldp's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 1 week ago - 2 years 1 week ago #226303 by oswaldp
Hey, I ended up finding a way to make it work, not sure it's very clean but I can sum it up as follows:
  1. Add an option intro_group_id to my theme where the user can configure a question group ID as the "Intro page group" (ex. 2)
  2. Add another option intro_chapters to my theme where the user can set a list of question group IDs that have to appear as "chapters" (ex. 21,22,23,24)
  3. Disable the default intro page

I can now access these options using aSurveyInfo.options.[option name].
So, in the Twig files of the theme, I have a kind of controller (lots of if statements) that checks what is the current group ID being viewed and then compares this ID with the one in the options.
--> IF current_group == aSurveyInfo.options.intro_group_id --> Display my custom intro page. In this page I can list the chapters defined in the options with aSurveyInfo.options.intro_chapters
Last edit: 2 years 1 week ago by oswaldp.

Please Log in to join the conversation.

  • upstacksolutions
  • upstacksolutions's Avatar
  • Offline
  • Junior Member
  • Junior Member
More
2 years 1 week ago #226312 by upstacksolutions
Replied by upstacksolutions on topic Have access to information about all question groups
Good you could manage what you were looking for ..

I wanted to make question index like quiz - 1, 2, 3, ... 

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose