deep-jade
deep-jade•2y ago

How to modify json before sending it to backend API

I have a Form.Item that is only for UI purposes. This is getting included in the backend JSON request automatically. How can I suppress/filter certain elements from being included in the backend JSON request? I have tried the following without success - hidden attribute in antd Form hides from the UI - Not what i want - included transform rules in Form.Item - throws an error in asyncvalidator saying "key" is not a valid undefined - Not able to change TVariables variable in create dataprovider method Any idea on how I can achieve this without changing the backend provider API ?
7 Replies
wise-white
wise-white•2y ago
useForm | refine
useForm is used to manage forms. It is based on Antd Form and refine useForm to supports all the features of these packages and adds some additional features.
sunny-green
sunny-green•2y ago
@aliemirs how can I achieve this in Material UI?
wise-white
wise-white•2y ago
useForm | refine
The @pankod/refine-react-hook-form adapter allows you to integrate the React Hook Form library with refine, enabling you to manage your forms in a headless manner. This adapter supports all of the features of both React Hook Form and refine's useForm hook, and you can use any of the React Hook Form examples as-is by copying and pasting them into...
wise-white
wise-white•2y ago
But the API is same basically since it's a feature of the @pankod/refine-core's useForm and the other packages are just extending it
sunny-green
sunny-green•2y ago
Thanks @aliemirs I will try this doc
wise-white
wise-white•2y ago
Happy to help, do not hesitate to send a new post if you encounter any issues 🚀
sunny-green
sunny-green•2y ago
Issue resolved, thanks @aliemirs @rapurush

Did you find this page helpful?