do not reset fields on submit
How can I stop refine from resetting all fields on submit at the login and register forms
6 Replies
Hi @BlackBearFTW. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To prevent refine from resetting all fields on submit, you can use the
autoResetForm
property. By default, this property is set to true
, which means the form will reset after a successful submit. You can set it to false
to stop this behavior.
Here's how you can configure it:
This configuration will ensure that the form does not reset automatically after submission. You can find more details about this property in the documentation (https://refine.dev/docs/ui-integrations/ant-design/hooks/use-modal-form/#autoresetform).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@490961337896402944> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
apparent-cyanOP•4w ago
@kapa.ai I am making use of const {mutate: register} = useRegister();
Let me check the knowledge base for you again. One moment! :books:
----------------------
To prevent the form fields from resetting when using the
useRegister
hook, you need to modify the form submission logic to avoid calling e.currentTarget.reset()
after the register
mutation. Here's an example based on the provided knowledge sources:
By removing or commenting out the e.currentTarget.reset();
line, the form fields will not reset after submission. This approach allows you to maintain the form state as needed.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@490961337896402944> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
apparent-cyanOP•4w ago
bruh
@contributor
is this actually possible
because kapa is making stuff up