Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

140
Visualizações
autocomplete of material-ui always return 0 onchange

when i try to change the value in autocomplete of material-ui, i always get its value 0, here i have uploaded my whole code, can anyone please check my code and help me to resolve this issue ? any help will be really appreciated.

type Props = {
    team?: Team;
    onSubmit: (params: TeamParams) => Promise<unknown>;
    onDelete?: () => void;
};

type State = {
    userId: string;
};

export const TeamForm: FC<Props> = ({ team, onSubmit, onDelete }) => {
  const { users } = useDataContext();
  const [state, setState] = useState<State>({
    userId: tearm?.userId.toString() || '',
  });

  :
  :

const userValue =
        users.find(user => user.id == Number(state.userId))
return (
  <Autocomplete
    options={users.map(
      c => `${c.id}: ${c.name}`,
    )}
    value={state.userId}
    inputValue={
      userValue?.id +
      userValue?.name
     }
     onChange={event =>
          setState({
               ...state,
               userId: (event.target as HTMLInputElement).value,
           })
      }
     renderInput={params => (
       <TextField
         {...params}
         fullWidth
         label='ユーザー'
       />
     )}
   />
  );
};

Also, if you add the following, you cannot modify the text box. can anyone please check my code and help me to resolve this issue ? any help will be really appreciated.

inputValue={`${userValue?.id}: ${userValue?.organizationName} ${userValue?.name}`}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda