Comments (9)
@romanlex it seems we ran into similar problems.
For me, calling .submit()
on the form did not work & reloaded the whole app.
See this tweet for more information on how i solved it.
Maybe you can even chime in and tell me why the heck the things i did actually worked, when .submit()
doesn't.
from react-final-form.
from react-final-form.
Now I use Portal https://gist.github.com/romanlex/bf61fb0c3db2ef1a6c68cb07a0904da2 but I think need remote submit method (
from react-final-form.
Wow, look at you using <Fragment>
already! 😮
Can you not pass handleSubmit
to your portal component?
from react-final-form.
if I remove handleSubmit my button doesnt work because buttons render to another domNode with Ract.createPortal
<CallbackForm
buttonPortalId={containerActionId}
subscription={{ submitting: true, pristine: true }}
/>
<footer
className="divider-block__footer-actions"
id={containerActionId}>
// my buttons
</footer>
from react-final-form.
It's not very React-y, but I wonder if you could use the DOM itself to achieve this, by calling submit()
?
<form id="myForm" onSubmit={handleSubmit}> ... </form>
...
<button type="button" onClick={() => document.getElementById('myForm').submit()}>
Submit
</button>
from react-final-form.
Beyond this little issue, the switch from redux-form
into react-final-form
seems really simple.
Thanks @erikras for the great work!
Thanks @romanlex for the workaround, I am also pretty curious on why only this way works as expected.
from react-final-form.
Hello! Why I use Portal but not use document.getElementById()
or submit by Closure?
Because I want use native state by react-final-form without any HOC with custom form state
I want disable button or use another function.
<button
className="btn btn-outline-secondary btn-block"
type="button"
onClick={reset}
disabled={submitting || pristine}>
Reset form
</button>
<button
className="btn btn-primary btn-block"
type="submit"
onClick={handleSubmit}
disabled={submitting}>
Submit
</button>
from react-final-form.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from react-final-form.
Related Issues (20)
- Feature request: new render prop `handleSubmitSync`
- Error messages on nested object values HOT 1
- Form Reset When Modal Close HOT 1
- Field State Sync Issue in Strict vs Non-Strict Mode in react-18 HOT 5
- Q: should readonly fields be validated on blur?
- Error in codesandbox example HOT 2
- Documentation for defaultValue of FieldProps is not matching implementation
- Warning message in console when using the field validation for a string field. HOT 3
- Ran into "is dirty" validation issues when state was used to autofill a form's input field. HOT 1
- [Feature Request] Add new prop to specify changes to specific form fields HOT 1
- change is not a function HOT 1
- Rewrite To Typescript HOT 2
- rerenderOnEveryChange for react-final-form
- <FormSpy> components rendering earlier than in previous versions
- DestroyOnUnregister incompatible with StrictMode in React18 HOT 2
- isEqual is initialized by the first field registered instance
- useField does not rerender component, when its props change
- Submitting Images in React Final Form
- I believe defaultValue should be the DEFAULT. That means, if NO initialValue was passed in, the defaultValue would be used. If there is an initialValue, it should override the defaultValue. One work around is using an OR in initialValues and skip using defaultValue all together like so:
- Form not dirty after removing items from FieldArray using final-form-arrays
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-final-form.