Script: Override Progress Percentage
This article will help you add code to a override the progress bar percentage calculation if needed
Background
You may need to override the 'Progress Bar' calculation. This will show you how to do so.
Instructions
- Access the 'Build & Edit' Tool
- Access the 'Default Text'
- See article: Default Text: Accessing Default Text Menu
- Click on the HTML Editor icon tied to the 'Survey Header'
- Access the Source Code Editor (</>)
- See Article: Source Code Editor
- While in the Source Code Editor, add the following code
- Update the 'modifyBeforePage' from 41 to the last page number of your survey you want this calculation to be modified
- Update the 'maxPercentage' from 12 to whatever you want the max percentage to be
<script> var modifyBeforePage = 41; var maxPercentage = 12; cmSurvey.onLoad(function() { var pageNum = parseInt(jQuery('.cm-pageWrapper').attr('id').replace('page-', ''), 10); if (pageNum < modifyBeforePage) { var newPercentage = ((pageNum * maxPercentage) / modifyBeforePage); newPercentage = Math.floor(newPercentage); jQuery('.cm-progress-bar-text').text(newPercentage + '% Complete'); } }); </script>