textField type=number: accepting negative values

vvkkumawat
创建于
2018-08-24 06:19:59

<TextField
id="age"
label="Age"
InputProps={{ inputProps: { min: 0 } }}
value={ this.state.age }
type="number"
onChange={ this.handleChangeAge('age') }
/>
In the above code i have set to not to take negative values. Arrow key down is working fine in this case, but when user is typing negative values manually, it is taking that.
Any solution for this?
thanks in advance.

1条回答
oliviertassinari
回复于
2018-08-24 07:36:00
#1

@vvkkumawat You would face the same issue with a native input.

当前位于第1页,总计1 条回复

推荐相似问题

Cannot override fonts with classeNames for Tabs component

Hello, We cannot find a way to override fonts easily in the Tabs component (or any component actually)... We are using t
讨论数 8
material-ui
创建时间:2018-08-23 21:00:39

Make Expansion Panels follow accessibly standards

Currently, if you have a link of any kind inside your panel and you tab through the page, the tab sequence will tab to h
讨论数 2
material-ui
创建时间:2018-08-23 16:59:35

Overriding the underline class in the component <Input /> not working

In the component <Input /> the CSS override option for the class 'underline' does not work. Meaning there is no way in t
讨论数 2
material-ui
创建时间:2018-08-23 16:03:31

Typescript fontWeight too restrictive

Current the typing for fontWeight (used with createStyles) doesn't allow other weights like "black" or "extra-bold". Cur
讨论数 4
material-ui
创建时间:2018-08-22 21:40:02

Compact display like compact gmail

The new gmail uses Material Design and offers a compact view. I searched for "compact" but couldn't find any guidance on
讨论数 3
material-ui
创建时间:2018-08-22 15:35:30

inputRef is not working in <TextField />

Hi, i'm not getting any this.refs value. Dynamically rendering the inputRef value. <TextField id={name} name={name} labe
讨论数 2
material-ui
创建时间:2018-08-22 11:52:23

core 1.5.1 breaks icons 1.*

Building breaks for users of @material-ui/icons 1.1.0 with error Error: Cannot find module '@babel/runtime/helpers/built
讨论数 16
material-ui
创建时间:2018-08-22 10:33:35

Custom TableSortLabel icon

I would like to have an option of overriding default sort icon. I've looked to TableSortLabel source and discovered that
讨论数 4
material-ui
创建时间:2018-08-22 08:09:05

[Modal] restoreFocus with backdrop click

This is a v1.x issue. I have searched the issues of this repository and believe that this is not a duplicate. Expected B
讨论数 3
material-ui
创建时间:2018-08-22 07:05:50

Theme not work for MuiSnackbar and MuiSnackbarContent after update to 1.5.0

Theme not work for MuiSnackbar and MuiSnackbarContent after update to 1.5.0 MuiSnackbar: { root: { [theme.brea
讨论数 6
material-ui
创建时间:2018-08-22 03:28:42