Welcome to the LimeSurvey Community Forum

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

Text Array 1st Column Checkbox Error??

  • marcgold
  • marcgold's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
2 years 1 month ago - 2 years 1 month ago #232343 by marcgold
Text Array 1st Column Checkbox Error?? was created by marcgold
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>


 
Last edit: 2 years 1 month ago by marcgold.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 1 month ago #232345 by tpartner
Replied by tpartner on topic Text Array 1st Column Checkbox Error??
I can't see that (or any) script affecting the session.

What happens in another (incognito) browser?

What if you remove the script?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose