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

onChange doesn't fire for TextFieldElement #52

Closed
sonusindhu opened this issue Jun 15, 2022 · 1 comment
Closed

onChange doesn't fire for TextFieldElement #52

sonusindhu opened this issue Jun 15, 2022 · 1 comment

Comments

@sonusindhu
Copy link

Hi,

I am not able to figure it out how to fire the onChange event for TextFieldElement component.

Here is the Example I have tried.

Could you please let me know if anything special required.

Thanks for the plugin.

@dohomi
Copy link
Owner

dohomi commented Jun 16, 2022

The TextFieldElement is using onChange for the internal react-hook-form as you can see here: https://github.com/dohomi/react-hook-form-mui/blob/master/src/TextFieldElement.tsx#L41

If you want to watch changes on the TextFieldElement then just use react-hook-form for this:

const value = useWatch('nameOfTextfield');

@dohomi dohomi closed this as completed in b585135 Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants