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

More
6 years 3 months ago - 6 years 3 months ago #201554 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.
Last edit: 6 years 3 months ago by Chuanse.
The topic has been locked.
More
6 years 3 months ago #201562 by Chuanse
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 :/
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.
More
6 years 3 months ago #201563 by Chuanse
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.
Moderators: tpartner, holch

Lime-years ahead

Online-surveys for every purse and purpose