Progress Bar shows wrong percentage display with hidden questions.

More
1 year 2 months ago #139895 by arunicbe
arunicbe created the topic: Progress Bar shows wrong percentage display with hidden questions.
I am using LS Version 2.50+ Build 160715.

I have a survey with 14 questions and 20 hidden equation questions.

The progress bar seems to be taking count of the hidden questions also. It shows around 26% when the last question is displayed (14th question).

Is it possible to fix this?

Please Log in to join the conversation.

More
1 year 2 months ago #139900 by jelo
jelo replied the topic: Progress Bar shows wrong percentage display with hidden questions.
Limesurvey is missing an option to calculate progress on shown questions instead of position.
You can support a feature request
bugs.limesurvey.org/view.php?id=9677

In that feature request you'll find a note how to modify the progressbar via JQuery.

Please Log in to join the conversation.

More
1 year 2 months ago #139904 by arunicbe
arunicbe replied the topic: Progress Bar shows wrong percentage display with hidden questions.
Hello,
Thanks.

I am trying your workaround. If I paste this script in endpage.pstpl. I get javascript error "Unexpected token <" .

<script type="text/javascript">
$(document).ready(function() {
modprocessbar({processbarValueStart},{processbarValueEnd});
});
</script>

On inspection it shows the error.
modprocessbar(<span class='em-expression em-haveerror'><span title='Undefined variable' class='em-error'><span title='Undefined variable' class='em-var em-var-error' >processbarValueStart</span></span></span>,<span class='em-expression em-haveerror'><span title='Undefined variable' class='em-error'><span title='Undefined variable' class='em-var em-var-error' >processbarValueEnd</span></span></span>);

Do I need to define the two variables.

Please Log in to join the conversation.

More
1 year 2 months ago #139909 by jelo
jelo replied the topic: Progress Bar shows wrong percentage display with hidden questions.
Via JavaScript/JQuery:

Read current value:
var valueprogress = $("#progressbar").progressbar("option","value");

Set value:
$("#progressbar").progressbar({
value: valueprogressnew
});

You might correct the progress by hand after finishing the survey design.
E.g. you can use the questions group to add the JavaScript and set the value of the progress-bar by hand.

The workaround in the Bugtracker is used to bridge surveys. The
processbarValueStart and processbarValueEnd are hidden equation questions.
That way the survey designer don't need to fiddle with the javascript code.
But it won't make any sense to use that part for your issue.

Please Log in to join the conversation.

More
1 year 2 months ago #139912 by arunicbe
arunicbe replied the topic: Progress Bar shows wrong percentage display with hidden questions.
Meanwhile I found this issue has been fixed.
bugs.limesurvey.org/plugin.php?page=Source/view&id=19386

I am using LS Version 2.50+ Build 160715. But this is not updated in this version.

Please Log in to join the conversation.

More
1 year 2 months ago #139914 by tpartner
tpartner replied the topic: Progress Bar shows wrong percentage display with hidden questions.
In version 2.5, the progress bars have been switched from jQuery to Bootstrap (for some reason?) so I think you will need to add something like this to the source of the group description or a question:

<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.
The following user(s) said Thank You: jelo

Please Log in to join the conversation.

More
1 year 2 months ago #139916 by jelo
jelo replied the topic: Progress Bar shows wrong percentage display with hidden questions.

tpartner wrote: In version 2.5, the progress bars have been switched from jQuery to Bootstrap (for some reason?)

Thanks for pointing that out. Looks like i no longer need to answer topics around LS 2.5. Currently no option for me to switch from LTS.

Please Log in to join the conversation.

More
5 months 1 day ago #155097 by bruce78
bruce78 replied the topic: Progress Bar shows wrong percentage display with hidden questions.

tpartner wrote: In version 2.5, the progress bars have been switched from jQuery to Bootstrap (for some reason?) so I think you will need to add something like this to the source of the group description or a question:

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


Thanks Tony, this works for me... I assume I can use this to set the progress bar % for any question or question group? Also, do you know if this will be upgrade safe between 2.5 and 3.0?

Please Log in to join the conversation.

More
5 months 1 day ago #155102 by tpartner
tpartner replied the topic: Progress Bar shows wrong percentage display with hidden questions.
Yes, you can use it in any question.

3.x will also use Bootstrap so you should be safe.

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

Please Log in to join the conversation.

More
5 months 1 day ago #155108 by bruce78
bruce78 replied the topic: Progress Bar shows wrong percentage display with hidden questions.
Great, thanks Tony...

Please Log in to join the conversation.

More
4 months 3 weeks ago #155476 by marektondryk
marektondryk replied the topic: Progress Bar shows wrong percentage display with hidden questions.
I have the same problem.
LS 2.64.7+170404
I have survey with 60 questions in six groups (10 questions in each group). There are 60 hidden equation questions which are displayed ( I don't know why - each one is hide :O ) and counted on a progress bar...
I have no idea what I'm doing wrong....

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now