ограничение на ввод букв на числовом инпуте
This commit is contained in:
parent
5a7697c5aa
commit
bc48cc0c33
@ -45,7 +45,7 @@ export default function CreateTariff() {
|
||||
const checkFulledFields = (values: Values) => {
|
||||
const errors = {nameField: "", amountField: "", privilegeIdField: ""} as any;
|
||||
// values.nameField = "aa"
|
||||
// values.amountField = "aa"
|
||||
values.amountField = String(Number(values.amountField.replace(/[^0-9]/g,"")))
|
||||
|
||||
if (values.nameField.length === 0) {
|
||||
errors.nameField = "Пустое название тарифа"
|
||||
@ -225,20 +225,14 @@ export default function CreateTariff() {
|
||||
</Typography>
|
||||
}
|
||||
/>
|
||||
<Field
|
||||
as={OutlinedInput}
|
||||
id="tariff-amount"
|
||||
type="number"
|
||||
variant="filled"
|
||||
<OutlinedInput
|
||||
id="amountField"
|
||||
name="amountField"
|
||||
onChange={(e) => props.handleChange(e.target.value)}
|
||||
value={props.values.amountField}
|
||||
label="Кол-во единиц привилегии"
|
||||
error={props.touched.amountField && !!props.errors.amountField}
|
||||
helperText={
|
||||
<Typography sx={{ fontSize: "12px", width: "200px" }}>
|
||||
{props.errors.amountField}
|
||||
</Typography>
|
||||
}
|
||||
/>
|
||||
type="number"
|
||||
/>
|
||||
<Field
|
||||
as={OutlinedInput}
|
||||
id="tariff-custom-price"
|
||||
|
Loading…
Reference in New Issue
Block a user