Welcome, Guest
Username: Password: Remember me

TOPIC: User Role based show/hide questions in a survey?

User Role based show/hide questions in a survey? 1 year 6 months ago #91020

  • AriM
  • AriM's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Thank you received: 1
  • Karma: 0
User taking the survey is authenticated, each user is assigned a GroupRole attribute in setup. In a survey questions are shown/hidden based on this attribute. Is this possible?
The administrator has disabled public write access.

Re: User Role based show/hide questions in a survey? 1 year 6 months ago #91022

  • holch
  • holch's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 2562
  • Thank you received: 291
  • Karma: 106
This should be possible if you use tokens. You can include the GroupRole attribute as a custom attribute in the token table and then refer to it from within the survey logic and show or hide a question, depending on the GroupRole from the token table.
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.
The following user(s) said Thank You: AriM

Re: User Role based show/hide questions in a survey? 1 year 5 months ago #92315

Hi holch,

Did you manage to implement it using tokens? I am trying to do something similar. I want the survey to be anonymous and I only want a limited number of subjects to participate, let's say 100. For 50 of them I want the variable (let's call it GroupRole) to take one value, say 1, and for the other 50 I want GroupRole to take value 2. Since I want the survey to be anonymous this means that any new user generates a new token (by introducing an e-mail account in the initial page), but for which the value of GroupRole is not defined... Did you run into a similar problem? Thanks for any feedback.
The administrator has disabled public write access.

Re: User Role based show/hide questions in a survey? 1 year 5 months ago #92316

  • AriM
  • AriM's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Thank you received: 1
  • Karma: 0
Pedrorobalo,

Holch answered my question.
I did not go further than that using tokens.
We are using Version 1.92+ Build 120517.
In DEV environment using token attributes works
but in TST environment I get undefined variable error for token
(which was fixed in Build 120418). I am working on that!

In any case, you can try the following not sure if it will work though:
create an equation question that uses random function (generate 1 or 2)
use quotas for this question(equation) response: 1 ---> 50responses
and similarly for response 2. No need for tokens unless you need it for another reason.

Holch might have a better answer for you.

Good Luck,

AriM
The administrator has disabled public write access.
The following user(s) said Thank You: pedrorobalo

Re: User Role based show/hide questions in a survey? 1 year 5 months ago #92318

AriM,

Thank you very much, that might solve my problems.

Best
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.129 seconds
Donation Image