- Posts: 16
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
First Option In Array (Numbers) (Checkboxes) Row Excludes All Others
- Georeorinc_191233
- Topic Author
- Offline
- Banned
Less
More
4 years 7 months ago #188133
by Georeorinc_191233
First Option In Array (Numbers) (Checkboxes) Row Excludes All Others was created by Georeorinc_191233
Hi,
Can I make the first column on my array an exclusive option? It's the same as Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others but I want the first column instead of last.
Thanks
Can I make the first column on my array an exclusive option? It's the same as Last Option In Array (Numbers) (Checkboxes) Row Excludes All Others but I want the first column instead of last.
Thanks
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12923
- Thank you received: 3977
4 years 7 months ago #188144
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic First Option In Array (Numbers) (Checkboxes) Row Excludes All Others
Hi,
your link refers to solutions of three different versions of LimeSurvey.
2.06, 2.50/2.73 and 3.x
If you work with version 3.x you see that in the script there is a part "$('.normal-item:last'"
Did you try to change it to "$('.normal-item:first'"?
Joffm
your link refers to solutions of three different versions of LimeSurvey.
2.06, 2.50/2.73 and 3.x
If you work with version 3.x you see that in the script there is a part "$('.normal-item:last'"
Did you try to change it to "$('.normal-item:first'"?
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: tpartner
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
4 years 7 months ago #188149
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 First Option In Array (Numbers) (Checkboxes) Row Excludes All Others
Why do I bother commenting code if no one reads it?
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.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13643
- Thank you received: 2491
4 years 7 months ago #188171
by DenisChenu
Thanks a lot for commenting your code
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 First Option In Array (Numbers) (Checkboxes) Row Excludes All Others
For the user who read ittpartner wrote: Why do I bother commenting code if no one reads it?
Thanks a lot for commenting your code
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.
- Georeorinc_191233
- Topic Author
- Offline
- Banned
Less
More
- Posts: 16
- Thank you received: 0
4 years 7 months ago #188202
by Georeorinc_191233
Replied by Georeorinc_191233 on topic First Option In Array (Numbers) (Checkboxes) Row Excludes All Others
Thank you! This is perfect.
The topic has been locked.
- Georeorinc_191233
- Topic Author
- Offline
- Banned
Less
More
- Posts: 16
- Thank you received: 0
4 years 7 months ago #188203
by Georeorinc_191233
Replied by Georeorinc_191233 on topic First Option In Array (Numbers) (Checkboxes) Row Excludes All Others
Hi guys,
One more thing:
Right now, when the user chose "no change desired" all other options are disabled. But I also want to set it up that when the "yes, do more often" was clicked they cannot select "yes, do less often" and vice versa. Is this possible?
Thanks a lot!
One more thing:
Right now, when the user chose "no change desired" all other options are disabled. But I also want to set it up that when the "yes, do more often" was clicked they cannot select "yes, do less often" and vice versa. Is this possible?
Thanks a lot!
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
4 years 7 months ago #188209
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 First Option In Array (Numbers) (Checkboxes) Row Excludes All Others
Can you attach a small sample survey (.lss file) containing only that question and your 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.
- Georeorinc_191233
- Topic Author
- Offline
- Banned
Less
More
- Posts: 16
- Thank you received: 0
4 years 7 months ago #188210
by Georeorinc_191233
Replied by Georeorinc_191233 on topic First Option In Array (Numbers) (Checkboxes) Row Excludes All Others
Hi Tony,
Attached is the LSS file.
Attached is the LSS file.
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
4 years 7 months ago #188221
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 First Option In Array (Numbers) (Checkboxes) Row Excludes All Others
This will render the column-2 and column-3 check-boxes exclusive of each other:
Here is your sample survey with that addition:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Listener on the column-2/column-3 checkboxes $('#question{QID} td.question-item:nth-child(3) input[type="checkbox"], #question{QID} td.question-item:nth-child(4) input[type="checkbox"]').on('change', function(e) { if($(this).is(':checked')) { var targetIndex = 3; if($(this).closest('td').is(':nth-child(3)')) { targetIndex = 4; } var thisRow = $(this).closest('tr'); // Uncheck the other checkbox $('td.question-item:nth-child('+targetIndex+') input[type="checkbox"]', thisRow).prop('checked', false).trigger('change'); } }); }); </script>
Here is your sample survey with that addition:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The topic has been locked.
- Georeorinc_191233
- Topic Author
- Offline
- Banned
Less
More
- Posts: 16
- Thank you received: 0
4 years 7 months ago #188227
by Georeorinc_191233
Replied by Georeorinc_191233 on topic First Option In Array (Numbers) (Checkboxes) Row Excludes All Others
Perfect! Thank you Tony!
The topic has been locked.