Check out the LimeSurvey source code on GitHub!

Incompatibility of workarounds?

5 years 3 months ago #69369 by cegreja

I have three ranking questions from which respondents may choose 3 options. Then I have an array question that shows as answers the 9 options that result from the previous choices made in the ranking questions. This is made possible using the script tpartner kindly elaborated:

<script type="text/javascript" charset="utf-8">

$(document).ready(function() {

rankFilter3 (14335, 14336, 14337, 14338);

// Filter an array by the results of 3 previous ranking questions
function rankFilter3 (q1ID, q2ID, q3ID, q4ID) {

// Add some classes to elements for manipulation
$('#question'+q1ID+', #question'+ q2ID+', #question'+ q3ID+'').addClass('filterQ');
$('#question'+q4ID+' tbody[id^="javatbd"]').each(function(i){
idArr = $(this).attr('id').split('X'+q4ID);

// Fire the filter function on page load

// Listeners on the ranking questions
$('.filterQ td.label, .filterQ td.output img').click(function(){
// Fire the filter function

// A function to filter an array depending on the results of previous ranking questions
function runFilter() {
// Hide all rows of the array
$('#question'+q4ID+' tbody[id^="javatbd"]').hide()
// Find all ranked items and show corresponding rows in the array
$('.filterQ input[id^="fvalue"]').each(function(i){
// Uncheck all radion in the array
$('#question'+q4ID+' tbody[id^="javatbd"]:hidden').attr('checked', false);


I also tried to aply the drag and drop function to the ranking questions using the workaround in the Wiki.

Both of the workarounds work in separate. However, together, the first function stops working, i.e, the array question (q4ID) no longer shows the options selected in previous questions. If I delete the drag and drop script, the problem no longer occurs.

Is there a way to have both functions working? Thanks

Please Log in to join the conversation.

5 years 3 months ago #69388 by Mazi
Can you post a link to a Demo survey?

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)'"

Please Log in to join the conversation.

5 years 3 months ago #69395 by tpartner
There may be some conflicts but try this:

In the drag-drop code, replace all instances of this:

With this:
rankFilter3 (14335, 14336, 14337, 14338);

Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form