<Form/> cannot submitted via ‘action’ property
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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của react-component/field-form
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
react-component/field-form#768 · 5 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
react-component/field-form#751 ·
-
Add getFieldsWarning API Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
react-component/field-form#749 ·
-
useWatch支持dynamic path Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
react-component/field-form#746 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
react-component/field-form#733 · 1 bình luận ·
Tất cả issue của react-component/field-form
Issue tương tự
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Crush Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
ElementsProject/cln-application#167 · 1 bình luận · 1 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Quantco/pnpm-licenses#17 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100