Estoy tratando de verificar si el archivo adjunto existe en la solicitud y el campo de archivo adjunto no existe en la forma en que muestra el mensaje en modal y lo mismo si el texto del cuerpo existe en la solicitud y el campo de texto enriquecido no existe en la forma en que muestra el error,
pero en mi caso, si existe un archivo adjunto en la solicitud y existe un campo de archivo adjunto, continúa y se mueve a otra cosa si el campo de texto enriquecido no existe en el formulario y no muestra el error porque no ejecuta el si dentro del si. No sé cómo puedo verificar ambas condiciones.
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); } }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); } }Luego puede unir los mensajes de error así si desea mostrarlos unidos con "y":
this.missingFields.join(" and ");