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

305
Visualizações
how can check two condition simultaneity in vue js

I am trying to check if attachment exist in request and attachment field not exist in form it show message in modal and same if body text exist in request and rich text field not exist in form it show error,

but in my case if attachment exist in request and attachment field is exist exist it continue and move to else if but rich text field not exist in form and it not show error because it not execute the if inside the if. I don't know how can i check both condition.

 if (this.selectedForm) {
    let attachmentField = this.selectedForm.formFields.filter(formField => {
      return formField.fieldAttributeType == 'attachment'
    })
    let descriptionField = this.selectedForm.formFields.filter(formField =>{
      return formField.fieldAttributeType == 'rich_text'
    })
    debugger
    if (this.request.attachments.length > 0 && attachmentField.length == 0) {
      debugger
      this.missingFields.push("Attachment field does't exist in custom form");
      if (this.request.bodyText.length > 0 && descriptionField.length == 0) {
        this.missingFields.push("and Rich_text field does't exist in custom form");
      }
      this.$refs.ticketCreationConfirmation.open();
    } else if (this.missingFields.length == 0){
      this.addRequest(this.request);     
    }
  }
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

if (this.selectedForm) {
    let attachmentField = this.selectedForm.formFields.filter(formField => {
        return formField.fieldAttributeType == 'attachment'
    })

    let descriptionField = this.selectedForm.formFields.filter(formField => {
        return formField.fieldAttributeType == 'rich_text'
    })

    if (this.request.attachments.length > 0 && attachmentField.length == 0) {
        this.missingFields.push("Attachment field doesn't exist in custom form");
    }

    if (this.request.bodyText.length > 0 && descriptionField.length == 0) {
        this.missingFields.push("Rich_text field doesn't exist in custom form");
    }

    if (this.missingFields.length > 0) {
        this.$refs.ticketCreationConfirmation.open();
    } else {
        this.addRequest(this.request);     
    }
  }

You can then join the error messages like that if you want to display them joined with "and":

this.missingFields.join(" and ");
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