not counting hidden questions in the progress bar

More
1 year 4 months ago #155291 by Siem
Siem replied the topic: not counting hidden questions in the progress bar
I added the below code to the source of the questions and I can see it in the page source.
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:

<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>
 

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #155294 by tpartner
tpartner replied the topic: not counting hidden questions in the progress bar
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.

<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.

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #155295 by Siem
Siem replied the topic: not counting hidden questions in the progress bar
This works better :)

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.

<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>

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #155297 by tpartner
tpartner replied the topic: not counting hidden questions in the progress bar
But...that's what LimeSurvey does automatically, so why bother with dynamically changing the progress value?

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

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #155298 by Siem
Siem replied the topic: not counting hidden questions in the progress bar
That's correct, but the number I want to divide by in the example is 226 - which is the number of real questions, excluding 24 hidden questions (that I need for the score calculation). LimeSurvey would use the value 250 there instead of 226.

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?

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #155299 by tpartner
tpartner replied the topic: not counting hidden questions in the progress bar
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.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: Siem

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #155301 by Siem
Siem replied the topic: not counting hidden questions in the progress bar
Actually that is very helpful! The hidden questions are at the end of the survey so this is perfect.
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>

Please Log in or Create an account to join the conversation.

More
2 months 4 weeks ago #171658 by Siem
Siem replied the topic: not counting hidden questions in the progress bar
<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.

Please Log in or Create an account to join the conversation.

More
2 months 4 weeks ago #171661 by DenisChenu
DenisChenu replied the topic: not counting hidden questions in the progress bar

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.

It was fixed before for sure …

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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

More
2 months 4 weeks ago #171684 by Siem
Siem replied the topic: not counting hidden questions in the progress bar
The reason I was using this workaround code in version 2.x is because LimeSurvey counts the hidden questions when calculating the progress-bar, so if you have a 10 question survey with 90 hidden questions at the end, the progress-bar will show 9% when you're at question 9.

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?

Please Log in or Create an account to join the conversation.

More
2 months 4 weeks ago #171687 by DenisChenu
DenisChenu replied the topic: not counting hidden questions in the progress bar

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?

Clearly : take hidden question in progress bar 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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

More
2 months 4 weeks ago #171713 by jelo
jelo replied the topic: not counting hidden questions in the progress bar

DenisChenu wrote:

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?

Clearly : take hidden question in progress bar 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

Are you a student conducting a survey? If yes, tell me why you use LimeSurvey?
www.limesurvey.org/forum/development/116...y-you-use-limesurvey
The following user(s) said Thank You: DenisChenu

Please Log in or Create an account to join the conversation.

More
2 months 4 weeks ago #171718 by DenisChenu
DenisChenu replied the topic: not counting hidden questions in the progress bar

jelo wrote: …

What was the conclusion: All kind of hidden questions should be not counted? What about hidden by css?

My point of view is hidden by attribute only (currently).

When we have hidden by css : the hidden system can not be really used in Question by question mode (shown only an hidden question), and in group by group mode : hope we have another question in same group :).

But : if we have hidden by EM : bugs.limesurvey.org/view.php?id=13835 system : we have same difficulty than "relevance equation".

I see only : relevance (or hidden) equation set to 0 to fix it …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!