- Posts: 55
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
not counting hidden questions in the progress bar
- Siem
- Topic Author
- Offline
- Senior Member
However it doesn't affect the progress bar. Is the code correct, or do I need to make other changes?
Many thanks in advance,
Simon
tpartner wrote: To set the value of the core progress bar, you can do something like this:
Code:<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Progress bar value $('#progress-wrapper').css('visibility', 'hidden'); setTimeout(function() { $('#progressbar').progressbar('value', 50 ); $('#progress-wrapper').css('visibility', 'visible'); }, 250); }); </script>
- tpartner
- Offline
- LimeSurvey Community Team
- Posts: 10629
- Thank you received: 3696
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var progressValue = 32; $('.progress-bar').css({ 'transition': 'width 0s ease 0s', 'width': progressValue+'%' }).attr('aria-valuenow', progressValue).text(progressValue+'%'); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
- Siem
- Topic Author
- Offline
- Senior Member
- Posts: 55
- Thank you received: 1
Would it be possible to get the current question number into the script, so the script calculates the progress-percentage itself, like below:
var progressValue = Math.round( currentQuestionNumber / 226) ; ?
tpartner wrote: That code is for previous versions of LimeSurvey. For the current version and the upcoming 3.x, use this code which applies to the Bootstrap progress bar.
Code:<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var progressValue = 32; $('.progress-bar').css({ 'transition': 'width 0s ease 0s', 'width': progressValue+'%' }).attr('aria-valuenow', progressValue).text(progressValue+'%'); }); </script>
- tpartner
- Offline
- LimeSurvey Community Team
- Posts: 10629
- Thank you received: 3696
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
- Siem
- Topic Author
- Offline
- Senior Member
- Posts: 55
- Thank you received: 1
The 226 questions are in the group 'data collection' and the 24 hidden questions in a separate group 'score calculation'.
tpartner wrote: But...that's what LimeSurvey does automatically, so why bother with dynamically changing the progress value?
- tpartner
- Offline
- LimeSurvey Community Team
- Posts: 10629
- Thank you received: 3696
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
- Siem
- Topic Author
- Offline
- Senior Member
- Posts: 55
- Thank you received: 1
Below is the working code (if anyone else has this problem):
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var QUESTIONS = 226; var progressValue = Math.round(({QUESTION_NUMBER}/QUESTIONS)*100); $('.progress-bar').css({ 'transition': 'width 0s ease 0s', 'width': progressValue+'%' }).attr('aria-valuenow', progressValue).text(progressValue+'%'); }); </script>
- Siem
- Topic Author
- Offline
- Senior Member
- Posts: 55
- Thank you received: 1
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var QUESTIONS = 226; var progressValue = Math.round(({QUESTION_NUMBER}/QUESTIONS)*100); $('.progress-bar').css({ 'transition': 'width 0s ease 0s', 'width': progressValue+'%' }).attr('aria-valuenow', progressValue).text(progressValue+'%'); }); </script>
I upgraded from Version 2 and unfortunately the code doesn't change the progress -bar in Version 3(.13.2).
How can fix it? Many thanks in advance.
- DenisChenu
- Offline
- LimeSurvey Community Team
- Posts: 13935
- Thank you received: 2551
It was fixed before for sure …tpartner wrote: I don't know of an automatic way to detect "currentQuestionNumber" that excludes hidden questions. LimeSurvey will return the question number with the {QUESTION_NUMBER} placeholder but that also includes hidden questions.
Not currently ? If not : someone must report issue .
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.
- Siem
- Topic Author
- Offline
- Senior Member
- Posts: 55
- Thank you received: 1
However when you enable 'Show "There are X questions in this survey"' it does shows the number of questions - excluding the hidden ones. So it would show "There are 10 questions in the survey" - which is correct from the participant perspective. It is inconsequent now.
I tested it and version 3.13.2+180709 counts hidden questions for the progress-bar calculation, and not for "There are X questions in this survey". Do you think the way the progress-bar handles it, is a bug?
Would it possible to change the 2.X progress-bar workaround code so the works with version 3?
- DenisChenu
- Offline
- LimeSurvey Community Team
- Posts: 13935
- Thank you received: 2551
Clearly : take hidden question in progress bar is a bug.Siem wrote: I tested it and version 3.13.2+180709 counts hidden questions for the progress-bar calculation, and not for "There are X questions in this survey". Do you think the way the progress-bar handles it, is a bug?
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.
- jelo
- Offline
- Platinum Member
- Posts: 5070
- Thank you received: 1263
DenisChenu wrote:
Clearly : take hidden question in progress bar is a bug.Siem wrote: I tested it and version 3.13.2+180709 counts hidden questions for the progress-bar calculation, and not for "There are X questions in this survey". Do you think the way the progress-bar handles it, is a bug?
bugs.limesurvey.org/view.php?id=11361
What was the conclusion: All kind of hidden questions should be not counted? What about hidden by css?
bugs.limesurvey.org/view.php?id=11665
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users