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

275
Visualizações
Enter key behaviour Angular and Material form

In my forms in a MEAN application I have:

<form novalidate [formGroup]="thesisForm"
  enctype="multipart/form-data"
  (keydown.enter)="$event.preventDefault()" (keydown.shift.enter)="$event.preventDefault()">

I do this because occasionally people press enter without wanting to submit the form. So to avoid accidents I add the prevent default.

BUT this results in text areas not reacting to the enter key and I cannot introduce line spaces. If I write the text and copy paste it I can add the new lines, but not when pressing enter . How can I fix this so that I can use the text area normally?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can leave preventDefault() on form element, and add (keydown.enter)="$event.stopPropagation()" on particular element (like textarea) and hitting enter there won't trigger a submit, and will allow new line in multi-line inputs.

about 4 years ago · Juan Pablo Isaza Relatório
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