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

390
Visualizações
How to reset the form validation on a create modal?

I am not sure what I should do here in this case. When I click on + Rule, I call this fn()

showAddRuleModal() {
    this.showAddRule = true

    this.$refs.form.reset()

    //reset form values
    this.ruleName = ''
    this.url = 'https://www.'
    this.urlType = 'Single'

    this.ruleDetails = []

    let ruleDetail = {
        attribute_id: '',
        operator_id: '',
        value: ''
    }

    this.ruleDetails.push(ruleDetail)
}

As you can see in the image, I successfully created a rule, and tried to add one more.

enter image description here

As you can see the other values seems to reset but my ruleName input detected as an error even if I reset this.$refs.form.reset()

How can I stop this ?


Note

If I add a space to the default value

this.ruleName = ' '

that error is gone, but now, my form ruleName contains a space. Works, but it's not great.

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

0

after the modal is opened use this:

this.$refs.form.resetValidation()

this should reset the validation. documentation example

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