> For the complete documentation index, see [llms.txt](https://docs.norrnext.com/norrcompetition/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.norrnext.com/norrcompetition/troubleshooting/user-is-not-able-to-vote-errors-in-the-console.md).

# 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.onclick
```

or

```
Uncaught TypeError: window.NorrCompetition is undefined
```

## Cause

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

1. In Joomla Administrator, go to **System > Plugins** and open **System - JCH Optimize**.
2. Navigate to the **Exclude Options** (or **Automatic Settings > Exclude Files**) tab.
3. Under **Exclude javascript files from extension**, select or add `com_competition`.
4. Alternatively, add the specific core script files to the exclusion list:
   * `media/com_competition/js/competition.min.js`
   * `media/com_competition/js/uikit.min.js`
5. Save the plugin settings and **Clean Cache** in Joomla (**System > Clear Cache** and clear JCH cache).

{% hint style="info" %}
For more details, consult the [JCH Optimize Documentation on Excluding Files and Inline Scripts](https://www.jch-optimize.net/documentation/minify-css-and-javascript.html).
{% endhint %}

### 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](/norrcompetition/faq/norrcompetition-and-yootheme-pro.md)).

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