- Posts: 21
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
.no-bottom{border-bottom:0;margin-bottom:0;} .no-bottom .answer-container {padding-bottom: 0em;}
Please Log in to join the conversation.
you have to learn the basics about it if you want to use it.I'm super noob about css and javascript...
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}'); // Add a question class thisQuestion.addClass('custom-array'); // Column-specific classes $('table.subquestion-list tr', thisQuestion).each(function(i) { $('th, td', this).each(function(i) { $(this).addClass('column-'+i); }); }); // Insert selects $('.answer-item.answer_cell_1', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\ <option value="">...</option>\ <option value="1">Option 1</option>\ <option value="2">Option 2</option>\ <option value="3">Option 3</option>\ </select>'); // Listeners on select elements $('.inserted-select', thisQuestion).on('change', function(i) { if($(this).val() != '') { $(this).closest('.answer-item').find('input:text').val($.trim($('option:selected', this).text())).trigger('change'); } else { $(this).closest('.answer-item').find('input:text').val('').trigger('change'); } }); // Returning to page $('.with-select input:text', thisQuestion).each(function(i) { var thisCell = $(this).closest('.answer-item'); var inputText = $.trim($(this).val()); $('select.inserted-select', thisCell).val(inputText); }); // Clean-up styles $('select.inserted-select', thisQuestion).css({ 'max-width': '100%' }); $('.with-select input:text', thisQuestion).css({ 'position': 'absolute', 'left': '-9999em' }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify this question var thisQuestion = $('#question{QID}'); // Column-specific classes $('tr.subquestion-list', thisQuestion).each(function(i) { $('th, td', this).each(function(i) { $(this).addClass('column-'+i); }); }); // Insert checkboxes $('.answer-item.column-2, .answer-item.column-3', thisQuestion).addClass('custom-checkbox-item'); $('.custom-checkbox-item', thisQuestion).each(function(i) { var thisID = $('input:text:eq(0)', this).attr('id'); $('label', this).before('<input class="" id="'+thisID+'" value="Y" type="checkbox" name="'+thisID.replace(/answer/, '')+'" />'); if($('input:text:eq(0)', this).val() == 'Y') { $('input:checkbox:eq(0)', this).prop('checked', true); } $(this).removeClass('text-item').addClass('checkbox-item'); $('input:text:eq(0)', this).remove(); }); }); </script>
<style type="text/css">.custom-array table.subquestion-list col { width: auto !important; } .custom-array table.subquestion-list thead .column-0 { width: 10%; } .custom-array table.subquestion-list thead .column-1 { width: 50%; } .custom-array table.subquestion-list thead .column-2 { width: 20%; } .custom-array table.subquestion-list thead .column-3 { width: 20%; } </style>
Please Log in to join the conversation.
Yes, I know. That's why I open this post, to get some directions to know what I have to search for, and your tips are awesome!you have to learn the basics about it if you want to use it.
Do you mean the file "custom.css" located at ".\limesurvey\themes\survey\fruity\css\custom.css"?which you put either into the "custom.css" of your extended theme
Do you mean here , where I put the question text, right? I've used some code before.or in the question text (in source code mode and surrounded by <style></style> tags)
Yes, and yes.Something like this? Or do you talk about more checkboxes?
Please Log in to join the conversation.
This is already answered by Joff by:Or do I have to "extend" my theme first within the theme editor?
into the "custom.css" of your extended theme
Please Log in to join the conversation.
Oh, yes, thanks.This is already answered by Joff by:
Please Log in to join the conversation.
This example is for the "extends_fruity" template.
Please Log in to join the conversation.
Please Log in to join the conversation.
I honestly thought that "extends_fruity" was the name of the template/theme.
Please Log in to join the conversation.
As you see there are no issues to attach images or files.(this editor is kind of buggy, I was not able to upload an image directly)
Please Log in to join the conversation.
Honestly, I didn't read the whole thing and that was the problem. The documentation is very extensive, so I usually search on the forum, or use the summary to jump to the section of interest (which this time made me miss important information).Sorry, but did you ever read the manual?
Well, I've tried to, but I thought maybe the problem was me. I'll make some styling as you suggested.And you can imagine that you can't place more than one checkbox in a column, but you can make it look like this by some styling.
About this, I don't know what I am doing wrong.So why can't you? Is there an error message? What happens?
Please Log in to join the conversation.
Please Log in to join the conversation.