jaredpalmer / formik

Build forms in React, without the tears 😭
https://formik.org
Apache License 2.0
34.02k stars 2.79k forks source link

add validation and get selected data in mui Autocomplete with yup and fromik #3763

Closed mm0hammadi closed 1 year ago

mm0hammadi commented 1 year ago

Bug report

Current Behavior

hi,

I want to validate for autocomplete using Formik and Yap. I did this according to the link. How should I act to receive the selected option and print it in the submit function? I want to do this without adding additional state. Is it possible? I have read the Formik and Material document, but I have not found a solution.

Expected behavior

Reproducible example

https://codesandbox.io/s/react-mui-dialog-demo-forked-qn36qq?file=/src/Demo.tsx

Suggested solution(s)

Additional context

Your environment

Software Version(s)
Formik 2.2.9
React 18.2.0
TypeScript 4.1.3
Browser chroume
npm/Yarn npm 18.9.2
Operating System windows
meysamzi commented 1 year ago

You should deal with autocomplete validation on your own, formik doesn't help you with that, i have been through the same issue.

mm0hammadi commented 1 year ago

Bug report

Current Behavior

hi,

I want to validate for autocomplete using Formik and Yap. I did this according to the link. How should I act to receive the selected option and print it in the submit function? I want to do this without adding additional state. Is it possible? I have read the Formik and Material document, but I have not found a solution.

Expected behavior

Reproducible example

https://codesandbox.io/s/react-mui-dialog-demo-forked-qn36qq?file=/src/Demo.tsx

Suggested solution(s)

Additional context

Your environment

Software Version(s) Formik 2.2.9 React 18.2.0 TypeScript 4.1.3 Browser chroume npm/Yarn npm 18.9.2 Operating System windows

Formik with Material-ui AutoComplete #3399