Welcome to the LimeSurvey Community Forum

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

Show/Hide Index of Questions depending on answer in text field

  • alexdp
  • alexdp's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 9 months ago #136535 by alexdp
Hello to you all,
A questionnaire will be filled by two distinct respondents (one member and one inspector). A token table will be used to invite participants.
The first respondent to the questionnaire will be shown his questions. After the respondent has completed all his questions, the second respondents will change the token in the token table and in the questionnaire so the first respondent will not be able to return to the questionnaire and change his answers.

The second respondent is identified by a valid code answer to the first question of the questionnaire. This question is "reserved to administration". Once the second respondent is identified, it would be nice to give him access to the index of questions so he has faster direct access to first responent answers. On the contrary, the index of questions should not be displayed to the first respondent (he will only be allowd to use previous button).

My question is how can one show or hide index question base on the value in a given field?

I am using LS 2.06.

Thank you, just to take the time to read this message.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago #136542 by tpartner
You may be able to use a token attribute placeholder ({TOKEN:ATTRIBUTE_1}) to add a class to the <body> element in startpage.pstpl and then use CSS to hide/show the index.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • alexdp
  • alexdp's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 9 months ago #136544 by alexdp
Hello Mr T.
What about this line of thought based on an answer you gave in the past for another problem:

A- General settings: Show question index set to Full (LS 2.06)

B- Question 1 (q001), short text type
With JS in that question, that tests if (q001 is empty or the last 3 characters in the string (PAT) is NOT equal to "PAT")
If true then add a class #index .hideindex so it does not appear on the page (display: none)
If false, do nothing since by default the question index is shown

This way, if Question 1 is empty or if it does not end with PAT, then the question index is not shown

C- Create #index .hideindex in template.css so
{
display: none
}
Does this make sense? and how can it be done? I do not know any jQuery or css.
Regards



<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$('#question{QID}').addClass('vas-slider-question');
});
</script>

Then in template.css:

.vas-slider-question .ui-slider {
/* Some style rules */
}
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago - 7 years 9 months ago #136548 by tpartner
That would only work on the page where q001 resides.

Given that you are modifying the tokens for the second respondent, I think the body class would be easier.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 9 months ago by tpartner.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose