Answer the question
In order to leave comments, you need to log in
React, Ant-Design. How to fix the problem of submitting data through the form?
Who used Ant design in React, tell me what could be the reason? When I send POST data in the form via and (Ant design) then the status code is 400 and in the form in the headers "undefined" it is as if the data was not sent, but if through plain HTML and then everything passes status - 201. Here is a piece of code
<Form
labelCol={{ span: 4, }}
wrapperCol={{ span: 12, }}
layout="horizontal"
onFinish={this.handleFinish}
>
<Form.Item
name='category'
label="Категория"
rules={[
{
required: true,
message: 'Пожалуйста выберите категорию',
},
]}
onChange={this.handleCategoryChange}
>
<Select
onChange={this.handleChange}
type='number'
allowClear
placeholder='Выберите категорию'
>
{categories.map(function (category) {
return (
<Select.Option
value={category.id}
key={category.id}
>{category.name}
</Select.Option >
)
})}
</Select>
</Form.Item>
</Form>
<Form
labelCol={{ span: 4, }}
wrapperCol={{ span: 12, }}
layout="horizontal"
onFinish={this.handleFinish}
>
<Form.Item
name='category'
label="Категория"
rules={[
{
required: true,
message: 'Пожалуйста выберите категорию',
},
]}
onChange={this.handleCategoryChange}
>
<select
onChange={this.handleChange}
type='number'
allowClear
placeholder='Выберите категорию'
>
{categories.map(function (category) {
return (
<option
value={category.id}
key={category.id}
>{category.name}
</option>
)
})}
</select>
</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