issue: Validation not working properly for MUI5 Datepicker #9244
-
Version Number7.37.0 Codesandbox/Expo snackhttps://codesandbox.io/s/cocky-banzai-lusgcv Steps to reproduce
Note: Expected behaviourI am expecting the error message to be hidden when clicking Submit button after selecting a Date from the Popup Modal of the Datepicker. However, it takes 2 clicks to validate the date and hide the error message before the form submits. What browsers are you seeing the problem on?No response Relevant log outputNo response Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
@sprobejames : This is not a bug. You are integrating react-hook-form with MUI in a wrong way.
Working demo: https://codesandbox.io/s/agitated-neumann-fyr8mp?file=/src/DatePicker.js |
Beta Was this translation helpful? Give feedback.
@sprobejames : This is not a bug. You are integrating react-hook-form with MUI in a wrong way.
{...register('fromDate')}
does not work as MUI date picker is using "inputRef" prop to pass ref callback not normal "ref" prop name.<DatePicker>
component, not to<TextField>
componen…