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

SelectButton: Submit with React Hook Form #3790

Closed
melloware opened this issue Dec 16, 2022 · 0 comments · Fixed by #3791
Closed

SelectButton: Submit with React Hook Form #3790

melloware opened this issue Dec 16, 2022 · 0 comments · Fixed by #3791
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@melloware
Copy link
Member

melloware commented Dec 16, 2022

Describe the bug

Same as: #3645

Forum Post: https://forum.primefaces.org/viewtopic.php?f=57&t=78159

When using SelectButton component with React Hook Form, on submit, if the password is the only field to fail validation then React Hook Form attempts to put a focus on the field but cannot and throws an error.

Reproducer

https://codesandbox.io/s/still-framework-7vr7uj?file=/src/App.js

PrimeReact version

8.7.3

React version

17.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

ALL

Steps to reproduce the behavior

Create a react hook form with at least one PrimeReact Password component (form can have other fields/inputs too).
Make sure the PrimeReact Password component has some kind of validation - for example, field is required.
Fill in all fields, except for the PrimeReact Password (or otherwise make this field invalid)
Submit the form to see e.focus / elm.focus error.

Expected behavior

With all other fields types, standard html text or password, PrimeReact InputText then when submitting the form, if there are errors the first field with an error is focused on.
I would expect that, if the PrimeReact SelectButton component is the first invalid field then the form should focus on this field too.

@melloware melloware added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Dec 16, 2022
@melloware melloware self-assigned this Dec 16, 2022
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Dec 16, 2022
@melloware melloware added this to the 8.7.4 milestone Dec 16, 2022
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Dec 16, 2022
melloware added a commit to melloware/primereact that referenced this issue Dec 16, 2022
melloware added a commit to melloware/primereact that referenced this issue Dec 16, 2022
@melloware melloware removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Dec 16, 2022
melloware added a commit to melloware/primereact that referenced this issue Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant