- Posts: 10
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Can I disable some fields within an array (Matrix)
- SvenF
- Topic Author
- Offline
- New Member
Less
More
9 years 11 months ago - 9 years 11 months ago #108058
by SvenF
Can I disable some fields within an array was created by SvenF
Hi,
I have to do an array question but not all questions have the same number of results.
It should look like this for example:
At question2 there should only 1 and 3 being selectable within the array.
Is this possible or must I do separate questions?
I have to do an array question but not all questions have the same number of results.
It should look like this for example:
1 | 2 | 3 | 4 | |
question1 | X | X | X | X |
question2 | X | X | ||
question3 | X | X | X | X |
At question2 there should only 1 and 3 being selectable within the array.
Is this possible or must I do separate questions?
Last edit: 9 years 11 months ago by SvenF.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
9 years 11 months ago - 9 years 11 months ago #108074
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 Can I disable some fields within an array
Assuming you are using a normal array question...
You can use JavaScript/jQuery to hide some of the radio inputs.
Set up your survey to use JavaScript and add a script like below to the question source. This will hide the sixth and eighth radios in the question.
You can use JavaScript/jQuery to hide some of the radio inputs.
Set up your survey to use JavaScript and add a script like below to the question source. This will hide the sixth and eighth radios in the question.
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#question{QID} input.radio:eq(5)').hide(); $('#question{QID} input.radio:eq(7)').hide(); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 9 years 11 months ago by tpartner.
The topic has been locked.
- SvenF
- Topic Author
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 0
9 years 11 months ago #108104
by SvenF
Replied by SvenF on topic Can I disable some fields within an array
Works fine - thank you
The topic has been locked.
- SvenF
- Topic Author
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 0
3 years 9 months ago #201503
by SvenF
Replied by SvenF on topic Can I disable some fields within an array (Matrix)
We are now using Lime Survey Pro Hosting. Is it differrent to hide some parts of the matrix? I used the same code as above. JS is running wenn I test with "alert('bla')" but the radios did not hide.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2737
3 years 9 months ago #201515
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Can I disable some fields within an array (Matrix)
It is the same as with Limesurvey CE. But the solution presented here is most probably not for the version LS 3.x LTS, but probably for LS 2.06 LTS or LS 2.7x, given that this is a 6 year old thread!
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- SvenF
- Topic Author
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 0
3 years 9 months ago #201526
by SvenF
Replied by SvenF on topic Can I disable some fields within an array (Matrix)
Ok - I know this is my old tread.
We use now LimeSurvey Professional Version 3.22.20. Is ist not possible with this version or can I use another solution?
We use now LimeSurvey Professional Version 3.22.20. Is ist not possible with this version or can I use another solution?
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2737
3 years 9 months ago #201527
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Can I disable some fields within an array (Matrix)
Should be possible, but needs adaptation, because the HTML of the new templates is different. But I am quite sure that this question has been solved for 3.x lts somewhere in the forum.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
3 years 9 months ago #201529
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 Can I disable some fields within an array (Matrix)
To follow the example above, try this (untested from memory as I'm responding via phone):
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Remove row 2, radio 2 $('#question{QID} tr[id^="javatbd"]:eq(1) .radio-item:eq(1) *').remove(); // Remove row 2, radio 4 $('#question{QID} tr[id^="javatbd"]:eq(1) .radio-item:eq(3) *').remove(); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- SvenF
- Topic Author
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 0
3 years 9 months ago #201565
by SvenF
Replied by SvenF on topic Can I disable some fields within an array (Matrix)
That works. Thank you.
The topic has been locked.