Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

radio array exclusieve optie mogelijk?

More
5 years 2 months ago #201555 by Chuanse
Hallo

ik heb een radio array met 40 vragen, antwoorden: ja/nee/misschien

Graag zou ik op de 41e rij een exclusieve optie willen toevoegen die alle ja/alle nee/alle misschien instelt voor de 40 vragen.

Is dat mogelijk?

Dank je!
The topic has been locked.
More
5 years 2 months ago #201561 by Chuanse
Kan evengoed alle antwoorden op JA zetten bij het laden van de array maar...
Deze doet het helaas niet 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 idea?
The topic has been locked.
More
5 years 2 months ago #201564 by Chuanse
Ah, gevonden voor 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 topic has been locked.
Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose