- Posts: 12779
- Thank you received: 3940
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Ranking question filtering
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
7 years 4 months ago - 7 years 4 months ago #144383
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Ranking question filtering
Hi, all,
it is in the "ranking.css", not in the templates.
There is.
instead of "rtl".
So please create a bug report.
Best regards
Joffm
it is in the "ranking.css", not in the templates.
There is.
Code:
:dir(ltr) .dragDropTable .columns2{float:right} .dragDropTable .clear{clear:both}
So please create a bug report.
Best regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 7 years 4 months ago by Joffm. Reason: Typo
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
7 years 4 months ago #144595
by DenisChenu
Update to last version, fixed since 2.53+161004 release.
github.com/LimeSurvey/LimeSurvey/commit/...363affb09738428a4021
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Ranking question filtering
No, please ...Joffm wrote: So please create a bug report.
Update to last version, fixed since 2.53+161004 release.
github.com/LimeSurvey/LimeSurvey/commit/...363affb09738428a4021
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- bcjewel
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
4 years 3 months ago #192381
by bcjewel
Replied by bcjewel on topic Ranking question filtering
Hi Tony - 3 years later, and we have a repeat of the same event happening, so I am using the same code that I used in 2016, but with a new version of Lime Survey - I'm now using 3.17.9+... and this code is not working. I've set "Filter HTML for XSS" to "Off" and used the exact same survey that I used in 2016, but none of the rank options show in this version. Any suggestions on how to make it work?
This is a sample of the code I'm using, this is for question "arHidden", then the following question (Active Rec) is a ranking question with an array filter of arHidden:
This is a sample of the code I'm using, this is for question "arHidden", then the following question (Active Rec) is a ranking question with an array filter of arHidden:
Code:
A hidden question to control the ranking. <script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify the questions var arHidden = $('#question{QID}'); var arHiddenID = $(arHidden).attr('id').replace(/question/, ''); // Hide the checkbox question arHidden.css({ 'position': 'absolute', 'left': '-9999em' }); // The ranking answer codes relevant for the various values of "Branch" // EDIT HERE AS REQUIRED var answerCodes = { 1: ['101', '102', '103', '104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114', '115'], // Seen by "Rangers" 2: ['101', '102', '103', '104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114', '115'], // Seen by "Pathfinders" 3: ['101', '103', '104', '105', '106', '108', '109', '110', '112', '114', '115'] // Seen by everybody else } // Get the value of the "Branch" question var branch = '{Branch}'; console.log(branch); // Define which set of ranking answer codes to display if(branch == 'Ranger') { var codeArray = answerCodes[1]; } else if(branch == 'Pathfinder') { var codeArray = answerCodes[2]; } else { var codeArray = answerCodes[3]; } // Toggle the appropriate checkboxes and fire Expression Manager $('input.checkbox[id$="X'+arHiddenID+this+'"]').prop('checked', false); $('.question-item input:hidden', arHidden).val(''); $(codeArray).each(function(i) { var thisInput = $('input.checkbox[id$="X'+arHiddenID+this+'"]'); thisInput.prop('checked', true); thisInput.nextAll('input:hidden').val('Y'); checkconditions(thisInput.value, thisInput.name, thisInput.type) }); }); </script>
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10629
- Thank you received: 3696
4 years 3 months ago #192383
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Ranking question filtering
In 3.x versions, you will need to deactivate AJAX in the survey theme options and use this code:
Sample survey attached:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Identify the questions var qHidden = $('#question{QID}'); var qHiddenID = $(qHidden).attr('id').replace(/question/, ''); // Hide the checkbox question qHidden.css({ 'position': 'absolute', 'left': '-9999em' }); // The ranking answer codes relevant for the various values of "Branch" // EDIT HERE AS REQUIRED var answerCodes = { 1: ['101', '102', '103', '104'], // Seen by "Rangers" 2: ['101', '102', '103', '104', '105', '106'], // Seen by "Pathfinders" 3: ['101', '102', '103', '104', '105', '106', '107', '108'] // Seen by everybody else } // Get the value of the "Branch" question var branch = '{Branch}'; // Define which set of ranking answer codes to display if(branch == 'Ranger') { var codeArray = answerCodes[1]; } else if(branch == 'Pathfinder') { var codeArray = answerCodes[2]; } else { var codeArray = answerCodes[3]; } // Toggle the appropriate checkboxes and fire Expression Manager $('.question-item input:hidden', qHidden).val(''); $('input:checkbox[id$="X'+qHiddenID+this+'"]').prop('checked', false).trigger('change'); $(codeArray).each(function(i) { var thisInput = $('input:checkbox[id$="X'+qHiddenID+this+'"]'); thisInput.nextAll('input:hidden').val('Y'); thisInput.prop('checked', true).trigger('change'); }); }); </script>
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The topic has been locked.
- bcjewel
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
4 years 3 months ago #192386
by bcjewel
Replied by bcjewel on topic Ranking question filtering
Thank you! I'm back in business! I truly appreciate your prompt response.
Julie
Julie
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12779
- Thank you received: 3940
4 years 3 months ago #192387
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Ranking question filtering
Hi,
let me join the conversation.
Is there a special reason to use javascript, and not an equation to set the relevant items in the hidden multiple question?
Like this:
Joffm
let me join the conversation.
Is there a special reason to use javascript, and not an equation to set the relevant items in the hidden multiple question?
Like this:
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10629
- Thank you received: 3696
4 years 2 months ago #192390
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Ranking question filtering
Nope, both will work.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.