- Posts: 7
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Radio array yes/no/maybe: exclusive option in last line (all yes/all no/all mayb
- Chuanse
- Topic Author
- Offline
- New Member
Less
More
3 years 10 months ago - 3 years 10 months ago #201554
by Chuanse
Radio array yes/no/maybe: exclusive option in last line (all yes/all no/all mayb was created by Chuanse
Hello there
I have a array with 40 questions. The array has radio buttons and possible answers are yes/no/maybe.
I would like to have a last line in the array that gives the options to set all yes/all no/all maybe for the other 40 questions.
Is that possible
Thank you.
I have a array with 40 questions. The array has radio buttons and possible answers are yes/no/maybe.
I would like to have a last line in the array that gives the options to set all yes/all no/all maybe for the other 40 questions.
Is that possible
Thank you.
Last edit: 3 years 10 months ago by Chuanse.
The topic has been locked.
- Chuanse
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 1
3 years 10 months ago #201562
by Chuanse
Replied by Chuanse on topic Radio array yes/no/maybe: exclusive option in last line (all yes/all no/all mayb
In fact, loading the array with all radio's in the first column selected would be great...
But this code is not working in Lime 3.22
Any ideas?
But this code is not working in Lime 3.22
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ var qID = 2768; // Loop through the rows and check the first radio if none are already checked $('#question'+qID+' table.question tbody tr').each(function(i) { if($('input.radio:checked', this).length == 0) { $('input.radio:eq(0)', this).attr('checked', true); } }); }); </script>
Any ideas?
The topic has been locked.
- Chuanse
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 1
3 years 10 months ago #201563
by Chuanse
Replied by Chuanse on topic Radio array yes/no/maybe: exclusive option in last line (all yes/all no/all mayb
Ah, found it for Lime 3.x
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Identify this question ID var qID = {QID}; // Loop through the rows and check the first radio if none are already checked $('#question'+qID+' .table-array-radio tr.answers-list').each(function(i) { if($('input[type="radio"]:checked', this).length == 0) { $('input[type="radio"]:eq(0)', this).trigger('click'); } }); }); </script>
The following user(s) said Thank You: DenisChenu
The topic has been locked.