Bien sûr que non.
Vous n'avez pas non plus de champs dans la base de données. Vous ne les avez affichés que visuellement.
Code:
<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 selects
$('.answer-item.column-1', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
<option value="">Choisir...</option>\
<option value="1">Maison > Porte</option>\
<option value="2">Maison > Sous-sol</option>\
</select>');
// Listeners
$('.inserted-select', thisQuestion).on('change', function(i) {
if($(this).val() != '') {
$(this).closest('.answer-item').find('input:text').val($('option:selected', this).val()).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'
});
// Insert checkboxes
$('.answer-item.column-2, .answer-item.column-3, .answer-item.column-4, .answer-item.column-5, .answer-item.column-6, .answer-item.column-7, .answer-item.column-8', 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>
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
// Insert the column categories
$('#question{QID} table.subquestion-list thead').prepend('<tr class="ls-heading">\
<td rowspan="1" colspan="1" style="border-bottom:0 !important;background-color:transparent"></td>\
<td rowspan="1" colspan="1" style="border-bottom:0 !important;background-color:transparent"></td>\
<th class="answer-text inserted-header" colspan="7" style="text-align:center;font-size:11pt;color:maroon;">Jours de la semaine</th>\
<td rowspan="1" colspan="1" style="border-bottom:0 !important"></td>\
</tr>');
});
</script>
<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);
});
});
});
</script>
Code:
<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: 18%; }
.custom-array table.subquestion-list thead .column-2 { width: 60%; }
.custom-array table.subquestion-list thead .column-3 { width: 12%; }
</style>