- Posts: 8529
- Karma: 621
- Thank you received: 2617
- Forum
- English support forums
- Can I do this with LimeSurvey?
- Multiple choice table - Discrete choice Models
Multiple choice table - Discrete choice Models
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Please Log in or Create an account to join the conversation.

It's nicely working.
Please Log in or Create an account to join the conversation.
My LimeSurvey got updated to Versão 2.73.0+171219.
The solution gave has stopped working, thus I would like to know if in this version there is any new and easier way to get it done?
(Note: this time I just need users to select one of two columns).
Please Log in or Create an account to join the conversation.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
Please Log in or Create an account to join the conversation.
- Posts: 8529
- Karma: 621
- Thank you received: 2617
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
var columnCount = $('#question{QID} table.subquestion-list thead tr:eq(0) > *').length;
$('#question{QID} table.subquestion-list').addClass('custom-array-1');
$('#question{QID} .no-more-tables').removeClass('no-more-tables');
$('#question{QID} .answer-item .visible-xs-block.label-text').remove();
$('#question{QID} table.subquestion-list thead tr:eq(0)').hide();
$('#question{QID} table.subquestion-list thead').append('<tr class="inserted-row"><td colspan='+columnCount+'></td></tr>');
$('#question{QID} table.subquestion-list .inserted-row td:eq(0)').html($('#question{QID} th.answertext:eq(0)').html());
$('#question{QID} th.answertext:eq(0)').html('');
});
</script>
And, this for the CSS:
table.custom-array-1 .inserted-row td {
text-align: center;
padding: 0;
}
table.custom-array-1 .inserted-row img {
width: 100%;
}
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Please Log in or Create an account to join the conversation.
So I have made a new questionnaire of Discrete choice.
However, now I have different problems than before.
The displacement between the question and the answer row is too big.
Aswell the tables display in phone screen sucks.
Here is a link with an example that I prepared:
surveys.uc.pt/index.php/488679?lang=pt
Basically i have inserted the table in the question infobox, then the subquestion field is empty ( and i think that's why there is a big space between the question and the answer row).
Regarding the display problem I have no idea, besides i don't have access to the platform programming files. Still, i have contacted the administrator and he told me that my LimeSurvey version is compatible with mobile phone display (LimeSurvey
Versão 2.73.0+171219).
Thanks in advance for any help or time spent on this subject.
Please Log in or Create an account to join the conversation.
- Posts: 8529
- Karma: 621
- Thank you received: 2617
Can you attach a small test survey containing only a single question?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Please Log in or Create an account to join the conversation.
surveys.uc.pt/index.php/797519?lang=pt
I dunno that it will help, but this is my table code:
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;">
<tbody>
<tr>
<td style="text-align: center;" width="0%"> </td>
<td style="text-align: center;" width="0%"> </td>
<td bgcolor="#D4D7E4" style="text-align: center;" width="40%"><br />
<span style="font-size:24px;"><strong>BANANAS</strong></span><br />
</td>
<td style="text-align: center;" width="0%"> </td>
<td bgcolor="#D4D7E4" style="text-align: center;" width="40%"><span style="font-size:24px;"><strong>GREEN APPLES</strong></span></td>
</tr>
<tr style="height: 6px; text-align: center;">
</tr>
<tr>
<td bgcolor="#f2f2f2" style="text-align: center;">
<p><span style="font-size:12px;"> </span><br />
<span style="font-size:18px;">Type of Vitamins</span><span style="font-size:12px;"> </span></p>
</td>
<td style="text-align: center;" width="0%"> </td>
<td bgcolor="#f2f2f2" style="text-align: center;">
<p> </p>
<div><span style="font-size:20px;"><strong>XX</strong></span></div>
<p> </p>
</td>
<td style="text-align: center;" width="0%"> </td>
<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:20px;"><strong>XXXX</strong></span></td>
</tr>
<tr style="height: 6px; text-align: center;">
</tr>
<tr>
<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:18px;">Hidratos</span></td>
<td style="text-align: center;" width="0%"> </td>
<td bgcolor="#f2f2f2" style="text-align: center;">
<p><span style="font-size:20px;"><strong>SUGAR</strong></span><br />
<br />
<span style="font-size:16px;">Bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla blabla bla bla bla bla bla bla bla blabla bla bla bla bla bla bla bla blabla bla bla bla bla bla bla bla bla blabla .</span></p>
</td>
<td style="text-align: center;" width="0%"> </td>
<td bgcolor="#f2f2f2">
<p style="text-align: center;"><span style="font-size: 20px;"><b>ACID JUICE</b></span><br />
<span style="font-size:16px;">Bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla blabla bla bla bla bla bla bla bla blabla bla bla bla bla bla bla bla blabla bla bla bla bla bla bla bla bla blabla .</span></p>
</td>
</tr>
<tr>
<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:18px;">Price</span></td>
<td style="text-align: center;" width="1%"> </td>
<td bgcolor="#f2f2f2" style="text-align: center;"><br />
<b>1 Kg - 1€</b><br />
</td>
<td style="text-align: center;" width="1%"> </td>
<td bgcolor="#f2f2f2" style="text-align: center;"><strong>1Kg - 0.95 €</strong></td>
</tr>
</tbody>
</table>
Please Log in or Create an account to join the conversation.
- Posts: 8529
- Karma: 621
- Thank you received: 2617
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- Posts: 8529
- Karma: 621
- Thank you received: 2617
You may still need some CSS tweaks for phones in portrait mode but test as-is first.
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;">
<tbody>
<tr>
<td style="text-align: center;" width="0%"> </td>
<td style="text-align: center;" width="0%"> </td>
<td bgcolor="#D4D7E4" style="text-align: center;" width="40%"><br />
<span style="font-size:24px;"><strong>BANANAS</strong></span><br />
</td>
<td style="text-align: center;" width="0%"> </td>
<td bgcolor="#D4D7E4" style="text-align: center;" width="40%"><span style="font-size:24px;"><strong>GREEN APPLES</strong></span></td>
</tr>
<tr style="height: 6px; text-align: center;">
</tr>
<tr>
<td bgcolor="#f2f2f2" style="text-align: center;">
<p><span style="font-size:12px;"> </span><br />
<span style="font-size:18px;">Type of Vitamins</span><span style="font-size:12px;"> </span></p>
</td>
<td style="text-align: center;" width="0%"> </td>
<td bgcolor="#f2f2f2" style="text-align: center;">
<p> </p>
<div><span style="font-size:20px;"><strong>XX</strong></span></div>
<p> </p>
</td>
<td style="text-align: center;" width="0%"> </td>
<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:20px;"><strong>XXXX</strong></span></td>
</tr>
<tr style="height: 6px; text-align: center;">
</tr>
<tr>
<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:18px;">Hidratos</span></td>
<td style="text-align: center;" width="0%"> </td>
<td bgcolor="#f2f2f2" style="text-align: center;">
<p><span style="font-size:20px;"><strong>SUGAR</strong></span><br />
<br />
<span style="font-size:16px;">Bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla blabla bla bla bla bla bla bla bla blabla bla bla bla bla bla bla bla blabla bla bla bla bla bla bla bla bla blabla .</span></p>
</td>
<td style="text-align: center;" width="0%"> </td>
<td bgcolor="#f2f2f2">
<p style="text-align: center;"><span style="font-size: 20px;"><b>ACID JUICE</b></span><br />
<span style="font-size:16px;">Bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla blabla bla bla bla bla bla bla bla blabla bla bla bla bla bla bla bla blabla bla bla bla bla bla bla bla bla blabla .</span></p>
</td>
</tr>
<tr>
<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:18px;">Price</span></td>
<td style="text-align: center;" width="1%"> </td>
<td bgcolor="#f2f2f2" style="text-align: center;"><br />
<b>1 Kg - 1€</b><br />
</td>
<td style="text-align: center;" width="1%"> </td>
<td bgcolor="#f2f2f2" style="text-align: center;"><strong>1Kg - 0.95 €</strong></td>
</tr>
<tr style="height: 6px; text-align: center;">
<td colspan="5"></td>
</tr>
<tr>
<td bgcolor="#f2f2f2" style="text-align: center;"></td>
<td style="text-align: center;" width="0%"> </td>
<td bgcolor="#f2f2f2" style="text-align: center;"></td>
<td style="text-align: center;" width="0%"> </td>
<td bgcolor="#f2f2f2"></td>
</tr>
</tbody>
</table>
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
// Identify this question
var thisQuestion = $('#question{QID}');
// Move the radios
$('.question-text table:eq(0) tr:last td:eq(2)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(0) *', thisQuestion));
$('.question-text table:eq(0) tr:last td:eq(4)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(1) *', thisQuestion));
// Some classes for presentation
$('.question-text table:eq(0) input:radio', thisQuestion).closest('td').addClass('answer-item radio-item text-center radio');
$('.question-text table:eq(0) .radio-item label', thisQuestion).show();
// Click event on the table cells
$('.question-text table:eq(0) .radio-item', thisQuestion).on('click', function(e) {
$('input:radio', this).trigger('click');
});
$('.question-text table:eq(0) input:radio', thisQuestion).on('click', function(e) {
e.stopPropagation();
});
// Clean-up styles
$('.answer-container', thisQuestion).hide();
$('.question-text table:eq(0) .label-text', thisQuestion).remove();
$('.question-text table:eq(0) .radio-text', thisQuestion).css({
'cursor': 'pointer'
});
});
</script>
Here is your test survey back with those changes:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Please Log in or Create an account to join the conversation.
I am using the Version 2.50+ Build 160620 in my browser which is made available by my university.
Please Log in or Create an account to join the conversation.
- Posts: 8529
- Karma: 621
- Thank you received: 2617
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- Posts: 8529
- Karma: 621
- Thank you received: 2617
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Please Log in or Create an account to join the conversation.