- Posts: 14270
- Thank you received: 4349
Ask the community, share ideas, and connect with other LimeSurvey users!
:dir(ltr) .dragDropTable .columns2{float:right} .dragDropTable .clear{clear:both}
No, please ...Joffm wrote: So please create a bug report.
A hidden question to control the ranking. <script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify the questions var arHidden = $('#question{QID}'); var arHiddenID = $(arHidden).attr('id').replace(/question/, ''); // Hide the checkbox question arHidden.css({ 'position': 'absolute', 'left': '-9999em' }); // The ranking answer codes relevant for the various values of "Branch" // EDIT HERE AS REQUIRED var answerCodes = { 1: ['101', '102', '103', '104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114', '115'], // Seen by "Rangers" 2: ['101', '102', '103', '104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114', '115'], // Seen by "Pathfinders" 3: ['101', '103', '104', '105', '106', '108', '109', '110', '112', '114', '115'] // Seen by everybody else } // Get the value of the "Branch" question var branch = '{Branch}'; console.log(branch); // Define which set of ranking answer codes to display if(branch == 'Ranger') { var codeArray = answerCodes[1]; } else if(branch == 'Pathfinder') { var codeArray = answerCodes[2]; } else { var codeArray = answerCodes[3]; } // Toggle the appropriate checkboxes and fire Expression Manager $('input.checkbox[id$="X'+arHiddenID+this+'"]').prop('checked', false); $('.question-item input:hidden', arHidden).val(''); $(codeArray).each(function(i) { var thisInput = $('input.checkbox[id$="X'+arHiddenID+this+'"]'); thisInput.prop('checked', true); thisInput.nextAll('input:hidden').val('Y'); checkconditions(thisInput.value, thisInput.name, thisInput.type) }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify the questions var qHidden = $('#question{QID}'); var qHiddenID = $(qHidden).attr('id').replace(/question/, ''); // Hide the checkbox question qHidden.css({ 'position': 'absolute', 'left': '-9999em' }); // The ranking answer codes relevant for the various values of "Branch" // EDIT HERE AS REQUIRED var answerCodes = { 1: ['101', '102', '103', '104'], // Seen by "Rangers" 2: ['101', '102', '103', '104', '105', '106'], // Seen by "Pathfinders" 3: ['101', '102', '103', '104', '105', '106', '107', '108'] // Seen by everybody else } // Get the value of the "Branch" question var branch = '{Branch}'; // Define which set of ranking answer codes to display if(branch == 'Ranger') { var codeArray = answerCodes[1]; } else if(branch == 'Pathfinder') { var codeArray = answerCodes[2]; } else { var codeArray = answerCodes[3]; } // Toggle the appropriate checkboxes and fire Expression Manager $('.question-item input:hidden', qHidden).val(''); $('input:checkbox[id$="X'+qHiddenID+this+'"]').prop('checked', false).trigger('change'); $(codeArray).each(function(i) { var thisInput = $('input:checkbox[id$="X'+qHiddenID+this+'"]'); thisInput.nextAll('input:hidden').val('Y'); thisInput.prop('checked', true).trigger('change'); }); }); </script>