The first script you provided worked somewhat...it showed me the Other (please specify) option but not the none of the above option. The second script didn't show either of them so the first one was very close....
Okay, so if anyone still cares, Dawna and I finally sorted it out. The main hurdles were that she was randomizing the answers of the filtered questions, using the "Other" option for every question and that she wanted the last 2 options to be "sticky".
So the final code is as follows (where the "Other" options are inserted with the LimeSurvey interface and the question code for "None of the above" is 98).
Phew!!!
Code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
// Find the survey, group and question 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 qIDStr = $('div.multiple-opt:eq(0)').attr('id');
var tmp2 = qIDStr.split('question');
var qID = tmp2[1];
}
// Place the "None of the above" option second last after randomization
$('li#javatbd'+sID+'X'+gID+'X'+qID+'98').insertBefore($('.survey-question-answer li:last'));
// Set an index for the second last option
var itemCount = $('.survey-question-answer li').length;
itemIndex = Number(itemCount-2);
// Show the last two options
window.setTimeout(function() {
$('.survey-question-answer li:eq('+itemIndex+')').show();
$('.survey-question-answer li:eq('+itemIndex+') input[type=hidden]:eq(0)').attr('value', 'on');
$('.survey-question-answer li:last').show();
$('.survey-question-answer li:last input[type=hidden]:eq(0)').attr('value', 'on');
}, 50);
});
</script>
Cheers,
Tony Partner Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Thank you very much. I'm using this script without problems in Firefox and Chrome but crashes in Internet Explorer. I, housed several hours but not how to make it work in IE.
Thank you very much Tony. I did the sample from Ubuntu and I could not test Internet Explorer to realize that it was working perfect. Then delete the questions that did not work in the original survey, we did back and now everything works correctly in FF, Chrome, IE 6, IE 7 and IE 8. Thank you very much for your help! Ariel
Hi, Tony
I have a similar issue but the codes that are posted in the forum don't seem to work for my case. I am wondering if you could help me with ediiting the JS codes?
So here is the background for the survey:
We have two multiple select questions. what i select for Q1 will pipe for Q2. People who select "don't know" at Q1 won't see Q2.However, i would like to show "Don't know" for Q2. For the current setting right now, "Don't know" and "Other, please specify" are not showing.