Conditional fields lose their value when not present #455
Unanswered
dan-gamble
asked this question in
Q&A
Replies: 1 comment
-
Conform does not keep any value of your form. What you get from Conform is just a value synced with the FormData API. If you want to persist the value, you need to eithe make the input visually hidden or render a hidden input yourself. The DOM is the source of truth of your formdata as that's what will be sent to the server regardless you are using Remix route action or NextJS server action. It would be bad if a library tells your the value exists, but it is not actually sent out to the server :) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the bug and the expected behavior
If an element disappears from the form it's value is then wiped from the
form.value
.I'd built quite a deeply nested tab-based form and discovered that when React removes an element from the DOM then
conform
also removes that value fromform.value
. I'd expect the data to stay as it was in the last state before the element was removed from the DOM.Conform version
v1.0.1
Steps to Reproduce the Bug or Issue
bike
orcar
object is removed from theform.value
For the sake of this demo I've used a select but this was initially discovered when I was using tabs
What browsers are you seeing the problem on?
Chrome, Firefox, Microsoft Edge, Safari, Others
Screenshots or Videos
No response
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions