chakra ui form

Hi guys! I have a question, maybe a silly one but im not very experienced with react and just starting to learn refine. Is it possible using the inferencer generated page for create and save to change the data before submitting? I have found this link with related information but it works using a form and the inferencer for ChakraUI doesn't generate any form. Any idea? Thank you
FAQ | refine
How can I change the form data before submitting it to the API?
3 Replies
secure-lavender8mo ago
hello @fuzzball1980 you can copy inferenced code any modify according to your needs. you can add form element too
sensitive-blue8mo ago
hi @alicanerdurmaz yes I know I Can modify the entire code but I want to take advantage of the inferencer generated code and touch it the minimun. I dont know how to access the default added buttons, and if I add another <form> I have to manually add the validations, the footer buttons, etc so it is basically start a crud from scratch. I believe there must be a way to extend the Edit, Create, List, Show components to access the features of the inferencer. but i dont know how to start 😫 oh! I found it in the documentation my bad! const onFinishHandler = (data: FieldValues) => { onFinish({, }); }; const { saveButtonProps, refineCore: { onFinish, formLoading, queryResult }, register, handleSubmit, resetField, formState: { errors }, } = useForm<HttpError>(); return (
<Create isLoading={formLoading} saveButtonProps={{ ...saveButtonProps, onClick: handleSubmit(onFinishHandler), }} > basically you can overwrite the onClick event on the saveButtonsProps thanks!
secure-lavender8mo ago
I'm glad to hear that. you can ask any question on #ask-any-question section