Issue in making MUI Autocompletion component with error validation and integrates into a React form
Unanswered
Allegheny mound ant posted this in #help-forum
Allegheny mound antOP
### Summary
In my Next project i made a MUI Autocomplete component named
Problem:
the problem is that I do not know really how can i use this
apply error validation(like
CodeSandBox:https://codesandbox.io/p/sandbox/github/Amith-AG/mui_autocomplete/tree/master
GitHub:,https://github.com/Amith-AG/mui_autocomplete.git
In my Next project i made a MUI Autocomplete component named
hsnComp(path:components/hsnComp.tsx) which is working fine as you can see in the given codesandbox(Note that I'm implementing autocompletion using mongoDb, we fetch description(string) and hsCode(string) from mongoDb and shows autocompletion suggestion(format:description(hsCode)) as users type in the textfield).Problem:
ZodSchema:hsn:z.object({
description:z.string(),
hsCode:z.string()
}),
#other field
#other fieldthe problem is that I do not know really how can i use this
hsnComp.tsx in page.tsx(form page) and apply error validation(like
required)since in this case I have to register both descriptionand hsCode in the formCodeSandBox:https://codesandbox.io/p/sandbox/github/Amith-AG/mui_autocomplete/tree/master
GitHub:,https://github.com/Amith-AG/mui_autocomplete.git