Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

<Form/> cannot submitted via ‘action’ property

オープン
#596 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
react, typescript
領域
frontend

調査の方向性

src/Form.tsx の 164–165 行付近にある submit イベント処理から始め、リンク先のデモリポジトリを実行して、失敗するネイティブ送信を再現してください。修正では、action と method を持つフォームがネイティブの仕組みを通じて送信できるようにしつつ、バリデーションの動作と onFinish の処理を維持する必要があります。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
TypeScript
スター
1k
フォーク
286
平均マージ
4日 16時間
マージ済み PR(30日)
1

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

react-component/field-form のほかの issue

react-component/field-form の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。