T
TanStack4mo ago
like-gold

Delete Field seems not working

Hello all, I have a complex form and there is a logic realted to one boolean switch field - when it goes false I need to delete some fields of the form not only on UI(this part is working) but on form level as well(this part is not working). I tried form.deleteField method inside listeners of the switch field but despite the fact it is called, still when I submit form the fields I deleted are still arriving as fields of submit value. What can I do with that? Maybe there is an alternative way? Thank you
2 Replies
tame-yellow
tame-yellow4mo ago
do you have a basic example of what your defaultValues look like? it might be a mismatch between when deleteField is called and when the rendering updates, but it's hard to tell without a reproducible example
like-gold
like-goldOP4mo ago
Got it. Thanks you. Let me try some things!

Did you find this page helpful?