Change values before sending to server
Hello,
I was wondering if it was possible to change the values of formProps?.data?.data before sending them to the server (i.e. I want to add/remove/modify information when I click on the save button) to send them correctly to the server.
2 Replies
Hi @realdragonma. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Yes, you can change the form data before submitting it to the API by modifying the
onFinish
function in the formProps
. You can create a custom handleOnFinish
function to modify the form data and then call the original onFinish
function from formProps
.
Here's an example of how you can modify the form data before submitting it:
In this example, the handleOnFinish
function is called when the form is submitted. You can modify the values
object as needed before calling the original onFinish
function from formProps
with the modified values.
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------
Sorry @realdragonma, I seem to be having a bit of trouble. Don't worry though, I've pinged my supprt and they will try to fix me up! :technologist:
Perhaps try again in 15mins?frail-apricot•16mo ago
you can use this https://refine.dev/docs/faq/#how-can-i-change-the-form-data-before-submitting-it-to-the-api
FAQ | refine
How can I change the form data before submitting it to the API?