I have two identical drop down lists. The respondent is supposed to make a first choice from the first list and a second choice from the second list. Making two identical choices make no sense but will certainly happen when several hundred kids are about to answer.
How can I make a check of the two answers? Only continue if the two answers are different, and show an error if they equals redirecting the respondent to make another choice in on of the lists?
I have just checked and the dropdown question doesn't have the option of array filter anyway, so this is not an option. There might be a solution with Javascript, but I have no idea.
Help us to help you!
Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
Assuming there are only two dropdowns on the page or the dropdowns are sequential, you can
set up your survey to use JavaScript
and add this script to the question source of the first dropdown.
This script will interrupt the submit process and compare the dropdown values.
Code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// Identify the questions
var q1 = $('#question'+{QID}+'');
var q2 = $(q1).nextAll('.list-dropdown:eq(0)');
var alertText = 'The two dropdowns cannot have the same answer.';
// On submit, compare the 2 dropdown values
$('#movenextbtn, #movesubmitbtn').click(function(){
if($('.answer-item select', q1).val() != '' && $('.answer-item select', q1).val() == $('.answer-item select', q2).val()) {
alert(alertText);
return false;
}
});
});
</script>
.
Cheers,
Tony Partner Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.