[Input Mask Reactive] Cannot read properties of undefined (reading 'replace')
input-mask-reactive
Reactive icon
Forge component by Steven Decock
Application Type
Reactive

Hello,

We are continuously getting the following error message;

Cannot read properties of undefined (reading 'replace') 

TypeError: Cannot read properties of undefined (reading 'replace')

Does anyone know how we can fix this?

Kind regards,

Furkan Çetin

Hi Furkan,

Can you share some details of your implementation? Also, did you check the browser's developer tools to check where that exception is raised?

Cheers,

António Pereira

Hi Furkan,

Indeed, some more information on this problem might help.  What makes you think it is related to the Input Mask Reactive components for example?

Can you reproduce the problem in a small example module that you can share?

Regards,

Steven

Hi Guys,

We do have this problem again and again;

I do not know how to reproduce this problem in a small example, but I will try and if I can reproduce it I will share it 

Kind regards,

Furkan

Hi Guys,

I have found the reason;

I had created two webblocks; 1 for normal numbers/decimals and 1 for percentages

Within these webblocks I had used the 'InputNumberMask' to define the basic settings in one central place for all the input fields. Within a screen I was using both webblocks and the error was caused by the percentage webblock. After removing the percentage webblock the error was gone. 

I do want to mention that for some reason the min and max input parameters don't work and I do need this for percentages

Hi Guys,

I have found the problem of the min and max input parameters;

In the 'InputNumberMask -> InitIMask -> RegisterInputMask' the code;

if ($parameters.Min !== 0) {
    maskOptions.min = $parameters.Min;
}
if ($parameters.Max !== 0) {
    maskOptions.max = $parameters.Max;
}

must be changed to

if ($parameters.Min !== 0) {
    maskOptions.blocks.num.min = $parameters.Min;
}
if ($parameters.Max !== 0) {
    maskOptions.blocks.num.max = $parameters.Max;
}

Would you change this in the code and publish a new version of the component?

Kind regards,

Furkan Çetin

Hi Furkan,

Thanks for finding (and fixing) this bug!

I've included the proposed changes to the code.  They can be found in the new 1.0.5 version.  Min and max properties should now work as intended.

Kind regards,

Steven

Hi Steven,

In our situation, the issue has been resolved, but after a few minutes of inactivity, this issue reoccurs. Maybe this information can help you for fixing it?

Kind Regards,

Furkan

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