You are a genius. Thanks a lot. Now is working perfectly.
I have two last question related to the beginning of this post, questions 2) and 3). I'll repeat them just to make it more readable and luckly more clear (sorry if it's redundant). Also I'll share a limesurvey link with the situations and the lss export file.
2)I have a two columns Array(Texts) item (p001) where each option/cell it’s a dropdown list in order to normalize the inputs. There is only one option from the first column (SQ001) that if the user select it ( SQ001 = "No"), the corresponding value from the second column should automatically be an specific value (SQ002 = "No corresponde").
For example: Array(text) p001
Column 1 = SQ001 (dropdown list)
Op1: Yes
Op2: No
Column 2 = SQ002 (dropdown list)
Op1: Compartido
Op2: Personal
Op3: No corresponde
The third option Op3 ("No corresponde") should only automatically appears if Op2 ("No") in column 1(SQ001) is chosen.
I use a script for the dropdown list logic in the Array(texts) columns.
Code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var qID = {QID};
// Define the select element (dropdown)
var select1 = '<select class="inserted-select form-control list-question-select">\
<option value="">-- Elija por favor --</option>\
<option value="si">Sí</option>\
<option value="no">No</option>\
</select>';
// Hide the text inputs
$('#question'+qID+' .answer_cell_SQ001 input[type="text"]').hide();
// Insert the select elements
$('#question'+qID+' .answer_cell_SQ001').append(select1);
// Initially select an option if the question has already been answered
$('#question'+qID+' .answer_cell_SQ001 input[type="text"]').each(function(i){
if($(this).val()) {
$(this).closest('td').find('.inserted-select').val($(this).val());
}
});
// Listener on the dropdowns - insert selected values into hidden text input
$('.inserted-select').change(function() {
$(this).closest('td').find('input[type="text"]').val($(this).val());
});
// Clean-up styles
$('select.inserted-select', thisQuestion).css({
'max-width': '100%'
});
$('input:text', thisQuestion).css({
'position': 'absolute',
'left': '-9999em'
});
});
$(document).ready(function() {
var qID = {QID};
// Define the select element (dropdown)
var select1 = '<select class="inserted-select form-control list-question-select">\
<option value="">-- Elija por favor --</option>\
<option value="personal">Personal</option>\
<option value="compartido">Compartido</option>\
<option value="nocorresponde">No corresponde</option>\
</select>';
// Hide the text inputs
$('#question'+qID+' .answer_cell_SQ002 input[type="text"]').hide();
// Insert the select elements
$('#question'+qID+' .answer_cell_SQ002').append(select1);
// Initially select an option if the question has already been answered
$('#question'+qID+' .answer_cell_SQ002 input[type="text"]').each(function(i){
if($(this).val()) {
$(this).closest('td').find('.inserted-select').val($(this).val());
}
});
// Listener on the dropdowns - insert selected values into hidden text input
$('.inserted-select').change(function() {
$(this).closest('td').find('input[type="text"]').val($(this).val());
});
// Clean-up styles
$('select.inserted-select', thisQuestion).css({
'max-width': '100%'
});
$('input:text', thisQuestion).css({
'position': 'absolute',
'left': '-9999em'
});
});
</script>
3) In a group/section of questions I have a Multiple choice item (p002) where users have to pick one or more options.
Then, in the same group/section, users have to chose only one option among those were picked in p002. I thought about using a radio list item to solve this situation (p003) using the same logic Joffm suggested before (with an ecuation item). I don't know whether this is possible in the same section of question or should i divide them in two separated groups?
Link of the survey
here
.