- Posts: 11
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
My featurerequest is more about a way to ensure that the indication of progress is correct.f1refly wrote: A calculation based on the number of visible questions would be great but of course, the system might not know the number of visible questions at the beginning if you are making run-time decisions about hiding them.
I'm looking for a solution under LS 2.5. There seems to be no live manipulation of the progress-bar possible.tpartner wrote: You can manually set the progress value with a little JavaScript in the group description.
What LimeSurvey version are you using?
Try something like this in the group description.I'm looking for a solution under LS 2.5...
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Progress bar value var progressValue = 50; $('.progress-bar').css('width', progressValue+'%').text(progressValue+'%'); }); </script>
function customProgressValue(progressValue) { $(document).ready(function() { $('.progress-bar').css('width', progressValue+'%').text(progressValue+'%'); }); }
<script type="text/javascript" charset="utf-8"> customProgressValue(65); </script>
tpartner wrote:
Try something like this in the group description.I'm looking for a solution under LS 2.5...
[code type=javascript]<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
Try the attached survey. There is a script in the first (only) group description to push the progress bar to 65%. It works for me in 2.52 (latest GIT pull) with the default template.Thanks for the example. Is it really for LS 2.5X.?
Did it worked on your installation?f1refly wrote: I'm using 2.53. Thanks!
$coreReplacements['PERCENTCOMPLETE'] = isset($percentcomplete) ? $percentcomplete : ''; // global
if ($surveyMode != 'survey' && isset($thissurvey['showprogress']) && $thissurvey['showprogress'] == 'Y') { if ($show_empty_group) { $percentcomplete = makegraph($_SESSION[$LEMsessid]['totalsteps'] + 1, $_SESSION[$LEMsessid]['totalsteps']); } else { $percentcomplete = makegraph($_SESSION[$LEMsessid]['step'], $_SESSION[$LEMsessid]['totalsteps']); }
function makegraph($currentstep, $total) { global $thissurvey; Yii::app()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl') . 'lime-progress.css'); $size = intval(($currentstep-1)/$total*100); $graph='htmlstuff...'; return $graph; }
function setTotalSteps($surveyid, array $thissurvey, $totalquestions) { switch($thissurvey['format']) { case "A": $_SESSION['survey_'.$surveyid]['totalsteps']=1; break; case "G": if (isset($_SESSION['survey_'.$surveyid]['grouplist'])) { $_SESSION['survey_'.$surveyid]['totalsteps']=count($_SESSION['survey_'.$surveyid]['grouplist']); } break; case "S": $_SESSION['survey_'.$surveyid]['totalsteps']=$totalquestions; } }