Answer the question
In order to leave comments, you need to log in
Why is antd validation not working?
Checking for email works fine, but it doesn't work with number. I enter a number, but it says that it is not a number
<Form name="nest-messages" {...layout} onFinish={onFinish} validateMessages={validateMessages}>
<Form.Item name={'email'} label="E-mail" rules={[{ type: 'email', message: 'Некорректный E-mail!'}]} initialValue={email}>
<Input />
</Form.Item>
<Form.Item name={'firstName'} label="Имя" rules={[{ required: true }]} initialValue={firstName}>
<Input />
</Form.Item>
<Form.Item name={'lastName'} label="Фамилия" rules={[{ required: true }]} initialValue={lastName}>
<Input />
</Form.Item>
<Form.Item name={'number'} label="Номер" rules={[{ type: 'number', message: 'Некорректный номер!' }]} initialValue={number}>
<Input />
</Form.Item>
<Form.Item wrapperCol={{ ...layout.wrapperCol, offset: 3 }}>
<Button type="primary" htmlType="submit" style={{ width: '100%' }}>
Сменить данные
</Button>
</Form.Item>
</Form>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question