How to get values of form before submit in useStepForm?
How to get values of form before submit in useStepForm?
2 Replies
Hi @tingadev. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To get the values of the form before submitting in useStepsForm, you can use the
submit
property of the hook to override the default submit behavior. This allows you to access and modify the form values before they are sent to the API. Here's how you can do it:
In this example, the submit
function receives the form values as an argument. You can then access these values, modify them if needed, and then call onFinish
with the final values you want to submit.
This approach is documented in the useStepsForm FAQ (https://refine.dev/docs/ui-integrations/ant-design/hooks/use-steps-form/#faq) for the Ant Design integration. The same principle applies to other UI integrations as well.
If you need to perform more complex operations or validations before submitting, you can expand on this pattern to include additional logic within the submit
function.
Remember that the exact implementation might vary slightly depending on the UI framework you're using with refine (Ant Design, Mantine, etc.), but the core concept remains the same.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@761921731505946634> Kapa.ai is still learning and improving, please let me know how I did by reacting below.