The 'e' is the only letter that's accepted in a number field because it allows for exponents. You could use input type="text" but it doesn't give you the browser's native up and down arrows that type="number" does. And the pattern attribute validates on submission but doesn't stop someone from typing the 'e' in the first place. In REACT you can use this to completely block the 'e' key from being typed in a number input:

<input type="number" onKeyDown={ (evt) => evt.key === 'e' && evt.preventDefault() } />
Answer from Jeff C on Stack Overflow
🌐
Medium
medium.com › @narendersaini32 › have-you-ever-used-number-input-and-added-special-logic-on-onchange-event-to-prevent-and-e-2164c11117e0
How to block +,- and e in Number Input | by Narender Saini | Medium
June 20, 2020 - In this article we will gonna learn how to write a util function to block these +, — and e in your number input. Let’s see below example. import React, { useState } from "react"; import "./styles.css";export default function App() { const [value, setValue] = useState(""); return ( <div className="App"> <input type="Number" value={value} onChange={({ target: { value } }) => { setValue(value); }} /> </div> ); } If you notice we are using a number input and it’s also working fine but we don’t want user to enter +, — and e while typing.
Discussions

React: How to prevent user from entering 'e', '+' and '-' for input type="number"
2 How to restrict user from entering numbers or special characters in to text input field in react class components · 0 Allow only alphanumeric characters in a text input ( Prevent just numbers ) 0 How to disable possibility to type numbers in string input field More on stackoverflow.com
🌐 stackoverflow.com
March 17, 2021
Only numbers. Input number in React - javascript
Since it is recommended to use Controlled Components in React, onChange would be enough. onKeyPress is weak in some scenarios like copy/paste. 2018-11-11T07:20:30.573Z+00:00 ... @ThulaniChivandikwa - this example works by using type="number" to reject all keys except 0-9+-. Then it tests for ... More on stackoverflow.com
🌐 stackoverflow.com
How to allow only numbers in textbox in reactjs? - Stack Overflow
How to allow only numbers in textbox in reactjs using regular expression only? More on stackoverflow.com
🌐 stackoverflow.com
reactjs - How to limit the text filed length with input type number in React JS and prevent entry of E,e, -, + etc - Stack Overflow
1. I want to limit the input type text field length to 6 (which means allow numbers only from 0 to 999999 range). 2. Even if it is of type number it allows entry of E, e, -, + . How to prevent thi... More on stackoverflow.com
🌐 stackoverflow.com
🌐
DEV Community
dev.to › narendersaini32 › how-to-block-and-e-in-number-input-1hoe
How to block +,- and e in Number Input - DEV Community
June 20, 2020 - In this article we will gonna learn how to write a util function to block these +, – and e in your number input. Let’s see below example. import React, { useState } from "react"; import "./styles.css"; export default function App() { const [value, setValue] = useState(""); return ( <div className="App"> <input type="Number" value={value} onChange={({ target: { value } }) => { setValue(value); }} /> </div> ); }
🌐
The Web Dev
thewebdev.info › home › how to prevent e and dot in an input type number with react?
How to prevent e and dot in an input type number with React? - The Web Dev
November 15, 2022 - To prevent e and dot in an input type number with React, we can validate the input value in the onChange prop function.
🌐
DEV Community
dev.to › anilsingh › allow-only-numbers-in-input-in-react-2m71
Allow only numbers in Input in React - DEV Community
December 3, 2019 - import React, { Component } from 'react'; class AllowOnlyNumber extends Component { constructor(props) { super(props); this.state = { telephone: '' }; this.onHandleTelephoneChange = this.onHandleTelephoneChange.bind(this); } onHandleTelephoneChange = e => { let telephone = e.target.value; if (!Number(telephone)) { return; } this.setState({ [e.target.name]: telephone }); }; render() { return ( < > < label > Allow only numbers in Input(React): < / label > < input type = "tel" name = "telephone" placeholder = "Telephone Number" value = { this.state.telephone } onChange = { this.onHandleTelephoneChange } / > < /> ); } } You can use regex and conditionally change state.
Find elsewhere
🌐
Bobby Hadz
bobbyhadz.com › blog › react-only-number-input
Create a Numbers only Input field in React.js | bobbyhadz
Alternatively, you can use an input type number, but that would allow the user to enter characters like e, -, ., etc. ... Copied!import {useState} from 'react'; const App = () => { const [value, setValue] = useState(''); const handleChange = ...
🌐
GitHub
github.com › react › react › issues › 13499
Number input breaks when letter "e" is entered · Issue #13499 · react/react
August 28, 2018 - Do you want to request a feature or report a bug? bug What is the current behavior? input[type=number] only allows entering numbers and letter "e" in the input. Native "input" input event is called for both numbers and the letter "e". Wi...
🌐
GitHub
github.com › redux-form › redux-form › issues › 3952
how to avoid 'e' in input type NUMBER · Issue #3952 · redux-form/redux-form
April 2, 2018 - Now, I'm using redux-form : "^7.2.0" version In the input type 'number' when I type 'e', the values in redux state be blank( ' ' ). I wonder that why in redux-state blank when I type 'e' BUT in UI I still see 'e' letters. I just want to ...
Author: redux-form
🌐
Stack Overflow
stackoverflow.com › questions › 49605236 › how-to-avoid-enotation-typing-for-input-type-number
how to avoid 'e'(notation) typing for input type number
Now, I'm using the redux-form to validate the form. AND I have input type number that need to enter just number (0-9) by range is 1-100 not allowed 'e'. I would like user can enter the values from
🌐
ItSolutionstuff
itsolutionstuff.com › post › react-how-to-allow-only-numbers-in-textboxexample.html
React - How to Allow Only Numbers in Textbox? - ItSolutionstuff.com
September 5, 2020 - In this example, i will show you simple example of allow only number in input text field in react js. we will write that code on change event.
🌐
Reddit
reddit.com › r/reactjs › how to make an input to take only numeric values and only a max of 12 digits using reactjs
r/reactjs on Reddit: How to make an input to take only numeric values and only a max of 12 digits Using Reactjs
May 7, 2022 -

Hi everyone,

I'm working with an input type of number and I'm trying to implement a logic where the input takes only numeric values and a max of 12 digits. I have added the type of number and max of 12 but it still not working. Using Reactjs

Here is a sample of my code...

{paymentForm.map((field, index) =>
field.control === FormControl.TEXT ? (
    <TextInput
        id={field.name}
        key={index}
        label={field.label}
        placeholder={field.placeholder}
        sx={field.customStyle || {}}
        valid={
            (!formik.errors[
                field.name as keyof typeof formik.errors
            ] &&
                formik.touched[
                    field.name as keyof typeof formik.errors
                ]) as boolean
        }
        mask={field.mask}
        max={"3"}
        maxLength={"3"}
       
        {...formik.getFieldMeta(field.name)}
        {...formik.getFieldProps(field.name)}
        onChange={(e) => formik.setFieldValue(field.name, e)}
    />
) : null,
)}