Welcome to the LimeSurvey Community Forum

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

Array (numbers) subquestions disabled

  • AlessandraAndreotti
  • AlessandraAndreotti's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 11 months ago - 5 years 11 months ago #168130 by AlessandraAndreotti
Array (numbers) subquestions disabled was created by AlessandraAndreotti
Hi,

I need to disable some array subquestions.

In the figure below you can find the explanation of what I need.



Moreover, I've attached a Limesurvey example.

Thanks in advance,
Alessandra

File Attachment:

File Name: limesurvey...2269.lss
File Size:21 KB
Last edit: 5 years 11 months ago by AlessandraAndreotti.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 11 months ago #168133 by tpartner
Replied by tpartner on topic Array (numbers) subquestions disabled
This will do it:

Code:
<script type="text/javascript" charset="utf-8">
  $(document).on('ready pjax:scriptcomplete',function(){
    $('#question{QID} tr.subquestion-list:eq(0) input[type="checkbox"]:gt(3)').prop('disabled', true);
    $('#question{QID} tr.subquestion-list:eq(1) input[type="checkbox"]:lt(4)').prop('disabled', true);
    $('#question{QID} tr.subquestion-list:eq(1) input[type="checkbox"]:gt(4)').prop('disabled', true);
    $('#question{QID} tr.subquestion-list:eq(2) input[type="checkbox"]:lt(5)').prop('disabled', true);
  });
</script>

Sample survey:

File Attachment:

File Name: limesurvey...2691.lss
File Size:22 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • AlessandraAndreotti
  • AlessandraAndreotti's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 11 months ago #168134 by AlessandraAndreotti
Replied by AlessandraAndreotti on topic Array (numbers) subquestions disabled
Hi Tony,
maybe I've explained bad myself. The image attached was just an example.
In general, when the questions group is opened, all the sub-questions must be enabled.
If the respondent answer "Column A" and/or "Column B" and/or "Column C" and/or "Column D", then the "Not available" and "Not applicable" columns must be disabled. If the respondent answer "Not available" or "Not applicable" then the remaining options ("Column A", Column B", "Column C" and "Column D") must be disabled.
This must be done in all the sub-questions.

Thanks for your appreciated help.
Alessandra
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 11 months ago #168135 by tpartner
Replied by tpartner on topic Array (numbers) subquestions disabled
Oops, sorry for being so literal.

Have a look at this post which describes how to render multiple columns as exclusive - www.limesurvey.org/forum/can-i-do-this-w...hers?start=15#168089

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: AlessandraAndreotti
The topic has been locked.
  • AlessandraAndreotti
  • AlessandraAndreotti's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 11 months ago #168139 by AlessandraAndreotti
Replied by AlessandraAndreotti on topic Array (numbers) subquestions disabled
Thank you very much Tony.

It works!

Best,
Alessandra
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose