- Posts: 16
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Hide matrix subquestions
- psoliveira
- Topic Author
- Offline
- New Member
Less
More
7 years 3 months ago #146541
by psoliveira
Hide matrix subquestions was created by psoliveira
Hi,
I've made a survey, that is currently active, but for now i need to hide some subquestions from a matrix question.
I'm using Limesurvey 2.05+.
Thank you for your help.
I've made a survey, that is currently active, but for now i need to hide some subquestions from a matrix question.
I'm using Limesurvey 2.05+.
Thank you for your help.
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12921
- Thank you received: 3976
7 years 3 months ago #146542
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Hide matrix subquestions
Hi, psoliveira,
I can test in 2.06+, but just use relevance in your subquestions.
see screenshots.
I can test in 2.06+, but just use relevance in your subquestions.
see screenshots.
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The topic has been locked.
- psoliveira
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
7 years 3 months ago #146543
by psoliveira
Replied by psoliveira on topic Hide matrix subquestions
Hi Joffm,
Thank you for your answer, but unfortunately i'm using the 2.05+ version and there's no relevance column.
Thank you for your answer, but unfortunately i'm using the 2.05+ version and there's no relevance column.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13642
- Thank you received: 2491
7 years 3 months ago #146555
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Hide matrix subquestions
Then : pre 2.6 solution
demonstration.sondages.pro/676785?lang=fr#
In french, but code are international
demonstration.sondages.pro/676785?lang=fr#
In french, but code are international
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: psoliveira
The topic has been locked.
- psoliveira
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
7 years 3 months ago #146559
by psoliveira
Replied by psoliveira on topic Hide matrix subquestions
Hi DenisChenu,
Thank you for you solution.
Your example needs another question to work as filter, but mine doesn't.
I was thinking something like:
A matrix with 10 subquestion, i want to hide subquestions 1, 2, 3, 6 and 8
$("#question{QID_SQ001}").hide();
$("#question{QID_SQ002}").hide();
$("#question{QID_SQ003}").hide();
$("#question{QID_SQ006}").hide();
$("#question{QID_SQ008}").hide();
Thank you for you solution.
Your example needs another question to work as filter, but mine doesn't.
I was thinking something like:
A matrix with 10 subquestion, i want to hide subquestions 1, 2, 3, 6 and 8
$("#question{QID_SQ001}").hide();
$("#question{QID_SQ002}").hide();
$("#question{QID_SQ003}").hide();
$("#question{QID_SQ006}").hide();
$("#question{QID_SQ008}").hide();
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
7 years 3 months ago #146570
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Hide matrix subquestions
You can remove rows with a script like this in the question source. (note that this may cause problems if the question is mandatory)
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Remove rows $('#javatbd{SGQ}SQ001').remove(); $('#javatbd{SGQ}SQ002').remove(); $('#javatbd{SGQ}SQ003').remove(); $('#javatbd{SGQ}SQ006').remove(); $('#javatbd{SGQ}SQ008').remove(); // Fix up the row classes var rowClass = 1; $('#question{QID} table.subquestions-list tbody tr').each(function(i) { if($(this).hasClass('sub-header-row')) { rowClass = 1 } else { rowClass++; $(this).removeClass('array1 array2') if(rowClass % 2 == 0) { $(this).addClass('array2'); } else { $(this).addClass('array1'); } } }); }); </script>
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: psoliveira
The topic has been locked.
- psoliveira
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
7 years 3 months ago #146574
by psoliveira
Replied by psoliveira on topic Hide matrix subquestions
Hi tpartner,
Your solution worked fine and was exactly what i need (the question is not mandatory).
Thank you very much.
I was triyng to adapt a code from DenisChenu, on another question that also was working, but i think yours is more complete.
Here was my solution:
Your solution worked fine and was exactly what i need (the question is not mandatory).
Thank you very much.
I was triyng to adapt a code from DenisChenu, on another question that also was working, but i think yours is more complete.
Here was my solution:
Code:
<script> $(function() { $('#javatbd{SGQ}SQ001').hide(); $('#javatbd{SGQ}SQ002').hide(); $('#javatbd{SGQ}SQ003').hide(); $('#javatbd{SGQ}SQ006').hide(); $('#javatbd{SGQ}SQ008').hide(); }); </script>
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
7 years 3 months ago #146576
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Hide matrix subquestions
That's very close to mine but I prefer to remove the rows instead of hiding in case someone is tabbing through the form.
I also like to fix the alternating row colours after removing rows.
I also like to fix the alternating row colours after removing rows.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13642
- Thank you received: 2491
7 years 3 months ago #146601
by DenisChenu
No ?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Hide matrix subquestions
If i don't make error : an input inside an hidden (display:none} element can not be tabbed ?tpartner wrote: That's very close to mine but I prefer to remove the rows instead of hiding in case someone is tabbing through the form.
No ?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
7 years 3 months ago #146616
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Hide matrix subquestions
Dunno, but I don't trust some browsers.
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: DenisChenu
The topic has been locked.