question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[AutoComplete] onChange not working in mui v5.2.7

See original GitHub issue

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

https://github.com/mui-org/material-ui/blob/v5.2.7/docs/src/pages/components/autocomplete/FreeSoloCreateOptionDialog.js

I direct copy the whole code from the web and run it it shows the onChange props not working (i put in the console.log) , when I key in the textfield nothing update.

Expected behavior 🤔

onChange will trigger when the textfield in AutoComplete text changed,

at least when i typing somehing on textfield, the onChange will print out something on the console.log

Steps to reproduce 🕹

Steps:

1.direct put into the App.js 2. 3. 4.

Context 🔦

autocomplete from mui v4 is nice, although is a bit messy and complicated for me.

but mui v5 look like still very buggy

Your environment 🌎

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
Google Chrome Version 96.0.4664.110 (Official Build) (64-bit)

  Output from `npx @mui/envinfo` goes here.
System:
    OS: Windows 10 10.0.19043
  Binaries:
    Node: 14.15.0 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 96.0.4664.110
    Edge: Spartan (44.19041.1266.0), Chromium (97.0.1072.55)
  npmPackages:
    @emotion/react: ^11.6.0 => 11.6.0
    @emotion/styled: ^11.6.0 => 11.6.0
    @mui/base:  5.0.0-alpha.58
    @mui/icons-material: ^5.2.0 => 5.2.5
    @mui/lab: ^5.0.0-alpha.58 => 5.0.0-alpha.58
    @mui/material: ^5.2.0 => 5.2.0
    @mui/private-theming:  5.2.2
    @mui/styled-engine:  5.2.0
    @mui/styles: ^5.2.1 => 5.2.1
    @mui/system:  5.2.2
    @mui/types:  7.1.0
    @mui/utils:  5.2.2
    @types/react:  17.0.37
    react: ^17.0.2 => 17.0.2
    react-dom: ^17.0.2 => 17.0.2
    typescript:  4.5.2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
mnajdovacommented, Jan 11, 2022

The onChange in the Autocomplete is invoked when the value inside the Autocomplete changes, for example new value is selected. You are probably looking for the onInputChange prop, in case if you want to track changes on the input field itself.

1reaction
drzackyllcommented, Jan 11, 2022

I see this is somehow already closed, but +1 for me. I tried migrating from @material-ui/lab to @mui but onChange does not fire in the new version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Material UI AutoComplete onChange not working in mui v5 ...
I have upgraded to material ui v5 but the onChange option in Autocomplete seems to be having errors. I can't figure out what's...
Read more >
Autocomplete API - Material UI
Name Type Default options * array renderInput * func autoComplete bool false
Read more >
FreeSoloCreateOption Material Demo
FreeSoloCreateOption Material Demo https://github.com/mui-org/material-ui/blob/v5.2.7/docs/src/pages/components/autocomplete/FreeSoloCreateOption.tsx.
Read more >
can't resolve '@material-ui/core/styles
the problem was solved according to the answer from @samokasha , the solution was using npm install @material-ui/core --save I used the same...
Read more >
React Material UI Tutorial - 13 - Autocomplete - YouTube
Courses - https://learn.codevolution.dev/ Support - https://www.paypal.me/Codevolution Github - https://github.com/gopinav⚡️ Checkout ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found