- Posts: 44
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Array question with Check box and Text box
- kevinleung
- Topic Author
- Offline
- Senior Member
Less
More
4 years 1 month ago #195172
by kevinleung
Array question with Check box and Text box was created by kevinleung
Hi All,
I am going to design a survey.
It is a array like this:
|5 Check box | 1 Text box|
Question 1 | | |
Question 2 | | |
Question 3 | | |
Question 4 | | |
...
Example:
I have found this sample, but it is dropdown list....
www.limesurvey.org/forum/can-i-do-this-w...opdown-list?start=15
Anyone could help me to make the change? thank you!
I am going to design a survey.
It is a array like this:
|5 Check box | 1 Text box|
Question 1 | | |
Question 2 | | |
Question 3 | | |
Question 4 | | |
...
Example:
I have found this sample, but it is dropdown list....
www.limesurvey.org/forum/can-i-do-this-w...opdown-list?start=15
Anyone could help me to make the change? thank you!
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12921
- Thank you received: 3976
4 years 1 month ago #195330
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Array question with Check box and Text box
Hi,
if you don't like the drop-downs, which in my opinion is the best solution so far,
you may have a look at this:
Joffm
if you don't like the drop-downs, which in my opinion is the best solution so far,
you may have a look at this:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify the questions var qArrayID = {QID}; var qArray = $('#question'+qArrayID); // var arrayLength = $('tr.answers-list', qArray).length; var qMultiText = qArray.nextAll('.multiple-short-txt:eq(0)'); // Hide the multi-short-text question $(qMultiText).hide(); $('table.questions-list col:not(.col-answers)', qArray).css('width', 'auto'); $('table.questions-list thead tr', qArray).append('<th class="answer-text inserted-column-label" /></th>'); $('table.questions-list thead tr th.answer-text.inserted-column-label', qArray).css('width','40%'); $('tr.answers-list', qArray).each(function(i) { $(this).append('<td class="answer-item text-item">\ </td>\ '); }); // Load the column label for the text inputs $('.inserted-column-label:eq(0)', qArray).text($('.ls-label-question', qMultiText).text()); $('.text-item', qArray).append('<label class="ls-label-xs-visibility">'+$('.ls-label-question', qMultiText).text()+'</label>'); // Loop through the multi-short-text sub-questions $('li.answer-item', qMultiText).each(function(i) { // Move the text inputs into the array $('input[type="text"]', this).appendTo($('tr.answers-list:eq('+i+') .text-item', qArray)); }); }); </script>
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- kevinleung
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 44
- Thank you received: 0
4 years 1 month ago #195331
by kevinleung
Replied by kevinleung on topic Array question with Check box and Text box
Hi Joffm,
Thank you very much for the help!
May I have the Multiple choice layout?
Kevin
Thank you very much for the help!
May I have the Multiple choice layout?
Kevin
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12921
- Thank you received: 3976
4 years 1 month ago #195332
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Array question with Check box and Text box
You may use this.
Adapt it to your needs.
www.limesurvey.org/forum/can-i-do-this-w...rray?start=45#170114
Joffm
Adapt it to your needs.
www.limesurvey.org/forum/can-i-do-this-w...rray?start=45#170114
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- kevinleung
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 44
- Thank you received: 0
4 years 1 month ago #195375
by kevinleung
Replied by kevinleung on topic Array question with Check box and Text box
Hi Joffm,
Thanks for the information! Really helpful.
Kevin
Thanks for the information! Really helpful.
Kevin
The topic has been locked.