Create an Array (Texts) type question and set "Numbers only" to "On".
Insert the following script into the question source. Note that since the question is numbers-only, the data recorded in column-2 will be 1 or 2, not M or F.
Sample survey attached:
Insert the following script into the question source. Note that since the question is numbers-only, the data recorded in column-2 will be 1 or 2, not M or F.
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
// Identify this question
var qID = {QID};
var thisQuestion = $('#question'+qID);
// Assign column-specific classes
$('table.subquestion-list tr', thisQuestion).each(function(i) {
$('> *:gt(0)', this).each(function(i){
$(this).addClass('column-'+(i+1));
$(this).attr('data-column', i+1);
});
});
// Hide the text inputs in columns 2
$('.column-2 input[type="text"]', thisQuestion).hide();
// Loop through all column-2 inputs
$('.answer-item.column-2 input[type="text"]', thisQuestion).each(function(i) {
var thisID = $(this).attr('id');
var thisValue = $(this).val();
// Insert the radios
$(this).parent().addClass('radio').append('<span class="inserted-radio-wrapper">\
<input id="'+thisID+'-M" class="radio" value="1" name="'+thisID.replace(/answer/, '')+'_radio" type="radio">\
<label class="control-label radio-label" for="'+thisID+'-M">Male</label>\
</span>\
<span class="inserted-radio-wrapper">\
<input id="'+thisID+'-F" class="radio" value="2" name="'+thisID.replace(/answer/, '')+'_radio" type="radio">\
<label class="control-label radio-label" for="'+thisID+'-F">Female</label>\
</span>');
// Initial radio states
$(this).closest('td').find('input[type="radio"][value="'+thisValue+'"]').prop('checked', true);
});
// Listener on the radios
$('.answer-item.column-2 input[type="radio"]', thisQuestion).on('click', function() {
var thisInput = $(this).closest('td').find('input[type="text"]');
$(this).closest('td').find('input[type="text"]').val($(this).val());
checkconditions($(thisInput).val(), $(thisInput).attr('name'), 'text');
});
// Insert some clean-up styles (could be placed in template.css)
$('<style type="text/css">\
#question'+qID+' thead th, #question'+qID+' .answer-item.column-2 {\
text-align:center \
}\
#question'+qID+' .answer-item.column-2 .inserted-radio-wrapper {\
display: inline-block;\
margin: 10px 10px 0 20px;\
}\
#question'+qID+' .answer-item.column-2 label {\
padding: 0;\
}\
#question'+qID+' .answer-item.column-2 .radio-label {\
padding-left: 3px;\
margin-right: 3px;\
}\
@media only screen and (max-width: 801px) {\
label.visible-xs-block {\
text-align: center;\
}\
label.visible-xs-block::before, label.visible-xs-block::after {\
display: none;\
}\
}\
</style>').appendTo( "head" )
});
</script>
Sample survey attached: