The form form in antd is required and only partially checked.

as detailed in the title:

develop PC-side projects with react, using the antd UI library, but when using form forms, there is a problem with verification required-- only partial validation.

as shown in the figure:

:




5formantdformreact-devtools

6:

for such a problem, it is true that I have thought a lot about it, but I do not know how to solve it. Have you ever encountered such a problem? Or is there any better idea to solve such a problem?


is the initial value of your seat type given "", "" and "it can be regarded as filling in


https://codesandbox.io/s/p2wl.
. Why don't I have a problem? Not even the most critical code. Are you developing state secrets?


since this won't work, you can try to generate errors manually. The idea is that when you submit, check which seat type has data, data, pass; no data, report an error. When
specifically uses Antd/Form 's setFields API, usage


, the name is usually misspelled. Check your ID or class


validateFields only check the following check rules check to see if (setFields) has set error, in other ways. Yesterday I also used setFields to set error and found that the check didn't work.

Menu