Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

<Form/> cannot submitted via ‘action’ property

Aperta
#596 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

Inizia in src/Form.tsx, nella gestione dell’evento submit intorno alle righe 164–165, quindi esegui il repository dimostrativo collegato per riprodurre l’invio nativo non riuscito. La correzione dovrebbe consentire a un modulo con action e method di essere inviato tramite il meccanismo nativo, preservando il comportamento di validazione e la gestione di onFinish.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
TypeScript
Stelle
1k
Fork
286
Merge medio
4g 16h
PR unite (30g)
1

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di react-component/field-form

Tutte le issue di react-component/field-form

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.