You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Catch the error thrown by autonumeric and display it in a better way on the page in an error block/div.
Generate an error on a wrong key as well like inputting a alphabet(a,b,c) in the field.
Current behavior
Error is being displayed on the console.
Expected behavior
Error should be catched, and the catch message should be displayed.
Steps to reproduce the problem
Use autoNumeric version <v4.6.0>
In the browser Firefox version <84.0>
On the Windows 10 operating system
Then instantiate the autoNumeric object with the following options:
try{newAutoNumeric(element[0],{maximumValue: 5000,unformatOnSubmit: true,showWarnings: true});}catch(e){console.log("I have catched this error.");}
The error is displayed on console, rather than the message.
I debug the process and found out that the error is thrown by static throwError(message) function in AutoNumericHelper.js , but i am unable to catch it, is there a way to catch it or is there a way to override the throwError function or should i just rewrite the throwError function in the AutoNumericHelper.js.
Also is there a way to capture alphabets/symbols pressed in the input control, as far as i understand the flow, the onKeyDown is the first event handler to be called and should be the function which checks for invalid keys, any help in this will be useful.
Thanks
The text was updated successfully, but these errors were encountered:
Hello @anandphulwani , sorry for the late reply.
You could try using the AutoNumeric custom events, for instance 'autoNumeric:invalidValue'.
Some of those events have a useful payload you might want to use.
Goal To Achieve
Current behavior
Error is being displayed on the console.
Expected behavior
Error should be catched, and the catch message should be displayed.
Steps to reproduce the problem
<v4.6.0>
<84.0>
I debug the process and found out that the error is thrown by static throwError(message) function in AutoNumericHelper.js , but i am unable to catch it, is there a way to catch it or is there a way to override the throwError function or should i just rewrite the throwError function in the AutoNumericHelper.js.
Also is there a way to capture alphabets/symbols pressed in the input control, as far as i understand the flow, the onKeyDown is the first event handler to be called and should be the function which checks for invalid keys, any help in this will be useful.
Thanks
The text was updated successfully, but these errors were encountered: