Welcome to the LimeSurvey Community Forum

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

Filter array by radio selection

  • jlwood
  • jlwood's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 7 months ago #141880 by jlwood
Filter array by radio selection was created by jlwood
Clearly I'm doing this wrong. I'm trying to limit the number of sub-questions in an array based on a selection in a previous radio list. I've got it working as long as the filtering array is not hidden, but when I set xafServRel in the attached sample to "Always Hide" the filter stops working.

The goal is as follows:
Select "Yes" to the first item -> See second Item "How many people" -> Select appropriate radio option -> Array is presented with 1 to 6 options, depending on choice in item 2
:S
The topic has been locked.
More
7 years 7 months ago - 7 years 7 months ago #141881 by jelo
Replied by jelo on topic Filter array by radio selection

jlwood wrote: I've got it working as long as the filtering array is not hidden, but when I set xafServRel in the attached sample to "Always Hide" the filter stops working.

Which version/build of LimeSurvey is used?

The problem with the advanced option to hide a question is that the question is completely removed.
Years ago there where plans to offer more than one hide mode for questions.
www.limesurvey.org/de/foren/can-i-do-thi...te-jquery-code#75966

The solution is to hide the question via Javascript or CSS.
Code:
<script>
$(document).ready(function()
{
$('#question628').hide();
});
</script>

You add this to the question-text ( source view in the editor) and hide the question (628 is the id of the question, which needs to be modified when using the snippet elsewhere)


The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Last edit: 7 years 7 months ago by jelo.
The following user(s) said Thank You: jlwood
The topic has been locked.
  • jlwood
  • jlwood's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 7 months ago #141882 by jlwood
Replied by jlwood on topic Filter array by radio selection
Thanks, I'm using v2.05 with plans to upgrade as soon as the University upgrades our version of MySQL I'll use the Javascript approach. I kept thinking there must be an option or other method I was missing, but hiding through JS won't do any real harm, just a little kludgey
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 7 months ago - 7 years 7 months ago #141885 by tpartner
Replied by tpartner on topic Filter array by radio selection
Just to update jelo's post a bit...you can use the QID placeholder in the jQuery selector instead of the actual ID to make the workaround more generic.

Code:
$('#question{QID}').hide();

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 7 months ago by tpartner.
The following user(s) said Thank You: jlwood
The topic has been locked.
More
7 years 7 months ago #141888 by jelo
Replied by jelo on topic Filter array by radio selection

tpartner wrote: you can use the QID placeholder in the jQuery selector

Nice, didn't had that on my radar. Is that possible since years? Or was that introduced in 2.05?
Thanks for bringing it up.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 7 months ago - 7 years 7 months ago #141901 by tpartner
Replied by tpartner on topic Filter array by radio selection
I think it was in 1.9x - when Thomas introduced Expression Manager.

Cheers,
Tony Partner

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

Lime-years ahead

Online-surveys for every purse and purpose