Cannot read properties of null (reading 'addEventListener')


I am using a forge component:

Restrict Chars Reactive - Overview | OutSystems  

and receiving this error after leaving the page

Here's the code level details of the component:

I didn't get this error on Dev environment only on Test. which is weird to me.

Any JavaScript developer can help me fix this?

Thank you.


Hi, the problem is that document.getElementById($parameters.WidgetId) is returning null. So later is trying to do addEventListener of an null element and that's the error. 

You should add a console.log of WidgetId and test on the console of the browser to verify what is its value and why is returning null document.getElementById of your widget

Kind regards

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.