Please help us help you and fill where relevant: Your LimeSurvey version: 3.28.30 Own server or LimeSurvey hosting: Own Server Survey theme/template: Fruity (Extended)
==================
I'm having a little difficulty with a script that seems to work in preview mode, but when i try and run the survey it states that the session has expired and I have no idea why.
Found this on the forum, and it does exactly what i need, with the exception of working
Code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
// Identify this question
var thisQuestion = $('#question{QID}');
// Assign column-specific classes
$('table.subquestion-list tr', thisQuestion).each(function(i) {
$('> *:gt(0)', this).each(function(i){
$(this).addClass('column-'+(i+1));
$(this).attr('data-column', i+1);
});
});
// Hide the text inputs in columns 1 and 4
$('.column-1 input[type="text"]', thisQuestion).hide();
// Insert the checkboxes into column 1
$('.answer-item.column-1').append('<input type="checkbox" Style="height:28px;Width:28px; display: initial;"/>');
// Initial checkbox states (if the question has already been answered)
$('.answer-item.column-1 input[type="text"]').each(function(i){
if($.trim($(this).val()) == 'Y') {
$(this).closest('td').find('.inserted-checkbox').attr('checked', true);
}
});
// Listener on the checkboxes (insert "Y" into hidden text input when checked)
$('.inserted-checkbox').change(function() {
if($(this).is(':checked')) {
$(this).closest('td').find('input[type="text"]').val('Y');
}
else {
$(this).closest('td').find('input[type="text"]').val('');
}
});
});
</script>