Welcome to the LimeSurvey Community Forum

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

Array (number) type question how to show 'ticks' in question as 'default answer'

  • yuehwa123
  • yuehwa123's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 6 months ago #188447 by yuehwa123
Hi all,

Thank you all in advance in reading this post. I am a newbie here.
Just wanna setup a questionnaire with 'Array(number)' question type. But I found that there were no 'default answer' button for this question type and I am wondering whether there are any methods to solve this issue?

My question settings with Y scale code 1-13 and X scale code a1-a6. And I want all 'a6' answers to be 'ticked' as a default answer. Anything that I could do with it?

Many Thanks!!
Sonny
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 6 months ago #188499 by tpartner
Adding this script to the question source should do the trick:

Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).on('ready pjax:scriptcomplete',function(){
 
    // Default answers
    if($('#question{QID} input:checkbox:checked').length == 0) {
      $('#question{QID} td:last-child input:hidden').val(1);
      $('#question{QID} td:last-child input:checkbox').prop('checked', true).trigger('change');
    }
  });
</script>

Sample survey attached:

File Attachment:

File Name: limesurvey...9-04.lss
File Size:36 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose