User is not able to vote. Errors in the console
Troubleshooting voting errors in the browser console caused by third-party JavaScript optimization or minification extensions.
Symptom
When a user attempts to vote (especially as a guest or when interacting with dynamic voting buttons), voting fails and errors appear in the browser developer tools console (F12 > Console), such as:
Uncaught ReferenceError: Competition is not defined at HTMLButtonElement.onclickor
Uncaught TypeError: window.NorrCompetition is undefinedCause
This issue almost always occurs when third-party script optimization or compression extensions (such as JCH Optimize, SpeedyPage, or template-level asset combiners) aggregate and re-compress JavaScript files that are already minified and managed by Joomla's WebAssetManager.
When an optimization tool changes the execution order of scripts, defers scripts incorrectly, or breaks scope closures during aggressive minification, the NorrCompetition voting script fails to initialize before user interactions occur.
Solution
1. Exclude NorrCompetition Assets in JCH Optimize
If your website uses JCH Optimize:
In Joomla Administrator, go to System > Plugins and open System - JCH Optimize.
Navigate to the Exclude Options (or Automatic Settings > Exclude Files) tab.
Under Exclude javascript files from extension, select or add
com_competition.Alternatively, add the specific core script files to the exclusion list:
media/com_competition/js/competition.min.jsmedia/com_competition/js/uikit.min.js
Save the plugin settings and Clean Cache in Joomla (System > Clear Cache and clear JCH cache).
2. Check Template Asset Bundlers & Defer Settings
If your template framework (e.g., Gantry, Helix Ultimate, YOOtheme Pro, Astroid) has built-in JavaScript compression:
Ensure that Defer Scripts does not defer core Joomla dependencies (
core.js,messages.js) or NorrCompetition bundle assets.If using YOOtheme Pro, ensure UIkit is not loaded twice (see NorrCompetition and YOOtheme Pro).
3. Verify CSRF Token and Cache Exclusions
If using page-level caching (Joomla System - Page Cache), ensure voting AJAX endpoints or pages with dynamic CSRF tokens are handled properly. In Joomla 5+, NorrCompetition automatically handles CSRF tokens for AJAX voting.
Last updated