- Posts: 4
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
Thanks for supporting Limesurvey by a donation!mjr244 wrote:
![]()
![]()
tpartner saves the day!!! Thank you so much! (Donating now!)
zunch2000 wrote: Since i didn't succeed i was wondering if someone could help me adjusting the code for the multiple question types in array which was planned for the default template, to fit the "Limespired" template?
tpartner wrote: Can you attach a sample survey?
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var newHeader = 'Age'; // Identify the questions var q1ID = '{QID}'; var q1 = $('#question'+q1ID+''); var q2 = $(q1).nextAll('.multiple-short-txt:eq(0)'); var q2ID = $(q2).attr('id').split('question')[1]; // Hide the second question $(q2).hide(); // Clean up the array widths imposed by LS $('.subquestions-list col', q1).css({ 'width':'auto' }); // Insert a new header in the array $('.subquestions-list thead td', q1).after('<th>'+newHeader+'</th>'); // Move the age inputs into the array $('.answers-list', q1).each(function(i) { $('.answertext', this).after('<td class="answer_cell_000"></td>'); }); $('input[type="text"]', q2).each(function(i) { $('.answer_cell_000:eq('+i+')', q1).append($(this)); }); // Some styles for the array (this could be done in template.css) $('.subquestions-list th, .subquestions-list td', q1).css({ 'padding':'3px 7px' }); }); </script>
.inlineRow td.questiontext { font-weight: normal; } #inlineWrapper0 td.questiontext { font-weight: bold; }
tpartner wrote: Ah, I see. The "Multiple question types in array" workaround won't work for you because it's designed for individual questions, not array type or multiple-text type questions.
In your case I think it would be easiest to simply create a new column in your array and insert the "Age" text inputs into it.
Here's your survey back with the array question placed before the multiple-text question. The source of the array question contains the script below