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

143
Visualizações
Overwrite Values react-hook-form

I have a form that conditionally displays inputs.

What I have to do is display a table with values taken from a search of a database which is in a form. I have this part down, but the problem is saving it. I have to use react-hook-form getValues() to get the values of the form, including what is displayed on the table. To do this, I created hidden inputs with default values of what I need to save. This part works, but the problem occurs when the condition is no longer met, for some reason it still has the values of these inputs saved even though they should not exist.

Ex/

condition ? (
<Controller 
  controllerstuff....
  <input value="tabledata" hidden/>
/>
) : (
<Controller 
 controllerstuff...
 <input value="overwrite other stuff" hidden/>
/>
)

So, how can I overwrite/remove these values I do not need or what would be the best way to save the values from the search using getValues()? Thanks in advance.

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