[Input Masks Mobile] Cannot read property 'classList' of null

[Input Masks Mobile] Cannot read property 'classList' of null

  
Forge Component
(7)
Published on 2017-11-15 by OutSystems Labs
7 votes
Published on 2017-11-15 by OutSystems Labs

Hi there,

I am using the credit card mask but i keep receveing the error Cannot read property 'classList' of null every time i change the input. (check the attached image)

My implementation is exactly the same as the one from Demo provided.

Any insights?

Temporary solution!

In the FindClosest action, at line 19 of JS, add the check before: [element.parentElement !== null && ...]

Corrected line:

if(element.parentElement !== null && !element.parentElement.classList.contains('screen')) {

Hello,

I've talked with Pedro Domingues, and the issue is being caused by the fact that the component was used in an empty screen, without any layout. With the layout, the problem stopped.

Nevertheless, we will add this to our backlog to improve the component.


Also, Maurilio is right: changing that line will prevent the issue from happening. However, in this particular case, since the screen class was never there, the functionality would still be impacted.


Cheers,

Samuel Jesus