useform-metadata

But the error is coming from the UserWithRoles
Omer
Omer585d ago
If useForm's queryResult is returning results then the problem cannot be here
equal-jade
equal-jade585d ago
Correct
Omer
Omer585d ago
Can you check your network requests? There we can find the wrong request
equal-jade
equal-jade585d ago
This is the query that is being sent out: query ($id: ID!) { user (id: $id) } And this is the message in the response: Field "user" of type "UserWithRoles" must have a selection of subfields. Did you mean "user { ... }"?
Omer
Omer585d ago
Does the error go away when you remove the useForm?
equal-jade
equal-jade585d ago
Haven't tried that Give me minute Yes, its still there
Omer
Omer585d ago
Let's try to remove useList as well
equal-jade
equal-jade585d ago
Just caught it It's coming from const { register, handleSubmit } = useReactHookForm({ } Import statement of the same: import { useForm as useReactHookForm } from '@pankod/refine-react-hook-form'
Omer
Omer585d ago
hmm why did you import two forms?
equal-jade
equal-jade585d ago
Both are two different things right?
Omer
Omer585d ago
@pankod/refine-react-hook-form package extends useForm already in core. So just use @pankod/refine-react-hook-form
equal-jade
equal-jade585d ago
Ohh
Omer
Omer585d ago
const userRolesList = useList<IUserRoles>({
resource: "userRoles",
metaData: { fields: [ "id", "type" ] }
})

const { register, handleSubmit } = useReactHookForm({
refineCoreProps: {
action: "edit",
metaData: { fields: [ "id", "name", { user_roles: ["id", "type"], } ] }
}
})

const formSubmitHandler = e => onFinish(e)
const userRolesList = useList<IUserRoles>({
resource: "userRoles",
metaData: { fields: [ "id", "type" ] }
})

const { register, handleSubmit } = useReactHookForm({
refineCoreProps: {
action: "edit",
metaData: { fields: [ "id", "name", { user_roles: ["id", "type"], } ] }
}
})

const formSubmitHandler = e => onFinish(e)
equal-jade
equal-jade585d ago
Omer
Omer585d ago
Yes definitely, you can have a look here to use the properties in core https://refine.dev/docs/packages/documentation/react-hook-form/useForm/#properties
equal-jade
equal-jade585d ago
Working fine now Thank you soo much Ömer Wouldn't have found this if it was not for you
Omer
Omer585d ago
Hooray!! parrot Do you think we should update the document so others don't make this mistake?
equal-jade
equal-jade585d ago
Yes definitely, I have gone through the documentation many times, but never came across this It will be a great help for everybody
Omer
Omer585d ago
Great, what kind of enhancement do you think would work?
equal-jade
equal-jade585d ago
My bad, its already there.
No description
equal-jade
equal-jade585d ago
Dunno how I missed it
equal-jade
equal-jade585d ago
useForm | refine
refine offers a React Hook Form adapter(@pankod/refine-react-hook-form) that allows you to use the React Hook Form library with refine. Thus, you can manage your forms in headless way.
Omer
Omer585d ago
ohh okay, thank you! 🎁
More Posts
Remove useModal form titleI want to remove title from useModalForm so i gave title ={null } its not workinguseExport with arrays in schemaI have resources that have array fields, which I am spreading to fields like `arrayItem.0.name, arrastartswith operatorstartswith operator not supportedediting usemodal form footeri am having a custom button in antmodal footer footer={<Button >okk</Button>} if i click on this sasetFilters for json objectis there a way to apply nested filters for json b object retuning from usetable , using setFiltersfiltering ant table based on useSelect hookconsider i have select dropdown where i have values as one, two and three . Below i have ant table wselectionSet issueError: unexpected null value for type "uuid": {"response":{"errors":[{"extensions":{"path":"$.selectselection sort issuefield "krseva_frequencies" not found in type: 'query_root': {"response":{"errors":[{"extensions":{"pmigration issues./node_modules/@pankod/refine-react-router/dist/esm/index.js 49:10-11 export 'useIsAuthenticated' (iNested Filtering in useTablehow to do nested filtering in useTable hook?Strapi issue.I am trying to replicate the invoice generator from here: https://refine.dev/blog/refine-react-adminantd filter tableconsider an example of antd table with columns as name,age,dob,and id . i am able to filter ant tablhow to select an item from dropdown listhow to select an item from dropdown list through click and pass that selected element to another comcommenti edited my comment, I needed to thank you on it for all your helpuseTable from refine-react-table is killing my IDEHi! I'm using `refine` with the new `mantineUI` integration. I'm trying to get a list working for soOverriding default padding of 'main' areaSorry for all the noob questions but what is the 'correct' way to override the default padding of thinitialValues empty in serachFormProps with syncWithLocation set to TrueHi, I am setting `syncWithLocation` to true for useTable from Antd, the `initialValues` in searchForLogin-componentHello team I am trying to setup a login component for a new project i am trying out in refine. Is thcustom-pageswith NextJSIntercept data for SaveButton on ModalHi. I'm really struggling to figure this out and it feels like it should be simple. I have a modal u