Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar: React Hook Form Demo #3145

Closed
andreluisos opened this issue Aug 8, 2022 · 5 comments
Closed

Calendar: React Hook Form Demo #3145

andreluisos opened this issue Aug 8, 2022 · 5 comments
Labels
Resolution: Duplicate Issue has already been reported or a pull request related to same issue has already been submitted

Comments

@andreluisos
Copy link

Describe the bug

When controlling the component with useForm (react-hook-form), if default value is set to empty string, instead of null, and showOnFocus is off, the field won't input data properly.

Reproducer

https://codesandbox.io/s/practical-bhaskara-dgq2g1

PrimeReact version

8.3.0

React version

18.x

Language

ES6

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Component must be under control of react-use-form (not sure if the same would happen with another librabry).
  2. Set the field's default value to empty string ('').
  3. set showOnFocus={false}.

Expected behavior

Proper data input.

@andreluisos andreluisos added Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible Type: Bug Issue contains a defect related to a specific component. labels Aug 8, 2022
@melloware
Copy link
Member

@andreluisos did you really mean to close this?

@andreluisos andreluisos reopened this Aug 8, 2022
@andreluisos
Copy link
Author

@andreluisos did you really mean to close this?

I wasn't sure because documentation says default value for Calendar is null.

@melloware melloware changed the title Component: Calendar Calendar: React Hook Form Demo Aug 8, 2022
@melloware
Copy link
Member

melloware commented Aug 8, 2022

It works for me see my demo: https://codesandbox.io/s/angry-shadow-ru4ix2?file=/src/demo/ReactHookFormDemo.js

I updated your Sandbox and had to add rules={{ required: "Birthday is required." }} ??

It works with date="" or date=null

@andreluisos
Copy link
Author

andreluisos commented Aug 8, 2022

It works for me see my demo: https://codesandbox.io/s/angry-shadow-ru4ix2?file=/src/demo/ReactHookFormDemo.js

I updated your Sandbox and had to add rules={{ required: "Birthday is required." }} ??

It works with date="" or date=null

Apparently, mask is also required to trigger the issue.

Add mask="99/99/9999" to your sandbox or check this one https://codesandbox.io/s/practical-bhaskara-dgq2g1 (I updated it).

@melloware
Copy link
Member

Yep duplicate of #2927 subscribe to that issue

@melloware melloware added Resolution: Duplicate Issue has already been reported or a pull request related to same issue has already been submitted and removed Type: Bug Issue contains a defect related to a specific component. Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Duplicate Issue has already been reported or a pull request related to same issue has already been submitted
Projects
None yet
Development

No branches or pull requests

2 participants