- Posts: 15
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> // Filter array by multi-opt but always show default option $(document).ready(function(){ var q1ID = 111; var q2ID = 222; // Find the survey and group IDs if($( 'input#fieldnames' ).length != 0) { var fieldNames = $('input#fieldnames').attr('value'); var tmp = fieldNames.split('X'); var sID = tmp[0]; var gID = tmp[1]; } var optionCode = ''; // Initially hide and clear all unwanted array rows $('#question'+q1ID+' input.checkbox').each(function(i) { inputID = $(this).attr('id'); var tmp2 = inputID.split(q1ID); var optionCode = tmp2[1]; if ($(this).attr('checked') == false) { $('#question'+q2ID+' table.question tbody#javatbd'+sID+'X'+gID+'X'+q2ID+optionCode+'').hide(); $('#question'+q2ID+' table.question tbody#javatbd'+sID+'X'+gID+'X'+q2ID+optionCode+' input.radio').each(function(i) { $(this).attr('checked', false); }); } }); // Listener on radio inputs $('#question'+q1ID+' td.answer, #question'+q1ID+' td.answer input.checkbox').click(function() { // Hide and clear all unwanted array rows $('#question'+q1ID+' input.checkbox').each(function(i) { inputID = $(this).attr('id'); var tmp2 = inputID.split(q1ID); var optionCode = tmp2[1]; if ($(this).attr('checked') == false) { $('#question'+q2ID+' table.question tbody#javatbd'+sID+'X'+gID+'X'+q2ID+optionCode+'').hide(); $('#question'+q2ID+' table.question tbody#javatbd'+sID+'X'+gID+'X'+q2ID+optionCode+' input.radio').each(function(i) { $(this).attr('checked', false); }); } else { $('#question'+q2ID+' table.question tbody#javatbd'+sID+'X'+gID+'X'+q2ID+optionCode+'').show(); } }); }); }); </script>
Did you disable the array filter in the advance settings for the array question?...the exclusive option is still not showing up...
I'll have to look into that tonight.Along with the exclusive option, I need the "other option" to also show up regardless of the answers/filter piping in from a previous question so those two will be constants.
The script is designed for a multi-options (checkbox) followed by an array (radio buttons) question.I have to use checkboxes (not radio buttons) for multiple responses
Hmm...now I'm a little confused. I thought you were filtering an array with a multiple options question (see my screenshot).The survey requires a multi-option (checkbox) array followed by another multi-option (checkbox) array filtered and including the exclusive option and other option as well...