Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

<Form/> cannot submitted via ‘action’ property

Đang mở
#596 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
react, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Bắt đầu trong src/Form.tsx, tại phần xử lý sự kiện submit quanh các dòng 164–165, sau đó chạy repository minh họa được liên kết để tái hiện lần gửi native bị lỗi. Bản sửa cần cho phép một form có action và method gửi thông qua cơ chế native, đồng thời giữ nguyên hành vi validation và việc xử lý onFinish.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

I'm currently experimenting with a login form implemented using rc-field-form at its core that interacts with an OAuth2/OIDC implementation that expects a traditional server side rendered app for the login form. For this reason, I want to not attach an onFinish() callback to the form, but instead submit it via the native <form> submit mechanism, by setting the action property on the form, like so:

<Form name="test-form" action="https://httpstat.us/200" method="post">
  <Field name="test-field">
    <input placeholder="test field" value={""}/>
  </Field>
  <button type="submit" value={"submit"}>
    Submit
  </button>
</Form>

Since FormProps transitively extends React.FormHTMLAttributes I was expecting this to work, but of course it doesn't because here the event propagation of the submit click is stopped in favour of delegating processing to the form instance. I think rc-field-form's behaviour would be less surprising if event propagation were only stopped if:

  • Form validation fails
  • An on finish callback is actually attached to the form.

Of course, the alternative would be to omit action (and probably method) from FormProps, though that hardly seems satisfactory to me.

A demonstrator reproducing the bug can be found here: https://github.com/ngrewe/rc-field-form-bug

Thanks,

Niels

Ngôn ngữ chính
TypeScript
Star
1k
Fork
286
Merge trung bình
4 ngày 16 giờ
Pull request đã merge (30 ngày)
1

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của react-component/field-form

Tất cả issue của react-component/field-form

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.