Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

297
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!