Welcome to the LimeSurvey Community Forum

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

Set default answers in Array (flexible) specific per subquestion

  • Sofieke
  • Sofieke's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 9 months ago #156034 by Sofieke
I am new in Lime survey and I am looking for a solution to set default answers in an Array.
I have to specify for each row a specific default answer.

I use the following, and it works, but it puts for each row (each subquestion) the same answer.
<script type="text/javascript">

$(document).ready(function() {
$('input[type=radio][id$=' + 3 + ']',
$('#question102573')).each (function () {
$(this).attr('checked', true);
});
});
</script>


I would like to specify a specific default answer for each specific subquestion.
I tried it with the following code (among others), but it is not working:
<script type="text/javascript">

$(document).ready(function() {
$('#answer916993X1185X102573SQ004-A2'). (function (){
$(this).attr('chekcked', true);
});
});
</script>

Some help would be much appreciated...
The topic has been locked.
  • Sofieke
  • Sofieke's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 9 months ago #156036 by Sofieke
I use Version 2.62.0 build 170124
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 8 months ago #156040 by DenisChenu
For such system (default answer on 'any question type), i prefer to use an Equation question type at start of survey.

For example, here : if the questio code are ARRAY
Code:
{ARRAY_SQ004=if(is_empty(ARRAY_SQ004),"A2",ARRAY_SQ004)}

Really more easy and speediest

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.
  • Sofieke
  • Sofieke's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 8 months ago #156065 by Sofieke
Thanks a lot! That was very helpful and it works perfectly!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose