useform attach initialfilter strapi v4
how can i attach filter in useform for edit? it works in useList.
8 Replies
Hey @.yoda.! I'm the kapa.ai support bot. I've searched through the docs to try to answer your question. :wave:
----------------------
In
edit
mode, you can pass queryOptions
(https://tanstack.com/query/v4/docs/react/reference/useQuery) options to useForm
by passing queryOptions
property. For example, if you want to attach a filter to useForm
in edit
mode, you can do the following:
For more information, please refer to the refine documentation (https://refine.dev/docs/api-reference/core/hooks/useForm).
----------------------useQuery | TanStack Query Docs
const {
data,
Did kapa.ai help answer your question?
<@271294719559073792> kapa.ai is still learning and improving, please let us how it did by reacting with a :thumbsup: or :thumbsdown:
flat-fuchsia•2y ago
Bots answer did not work
foreign-sapphire•2y ago
Hello @.yoda. since edit is related to single resource, I'm not sure if you should have filter on useForm.
flat-fuchsia•2y ago
@batuhanw thanks for the quick answer. since i am working with strapi in the backend i try to send some extra information to the backend to check some logic. is there a way i can attach this extra information to the useForm?
foreign-sapphire•2y ago
Hello @.yoda., you can use metaData field to pass extra fields to your data provider:
https://refine.dev/docs/packages/documentation/react-hook-form/useForm/#metadata
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...
flat-fuchsia•2y ago
Thanks a lot 👍