From a8659e37bd3d06133060018af7e3f8f676a8e563 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 7 Jun 2023 17:46:06 +0200 Subject: [PATCH] check required in valiator --- .../ContributionForm/#ContributionForm.vue# | 623 ++++++++++++++++++ .../ContributionForm/ContributionForm.vue | 17 +- 2 files changed, 636 insertions(+), 4 deletions(-) create mode 100644 webapp/components/ContributionForm/#ContributionForm.vue# diff --git a/webapp/components/ContributionForm/#ContributionForm.vue# b/webapp/components/ContributionForm/#ContributionForm.vue# new file mode 100644 index 000000000..1d1353b1e --- /dev/null +++ b/webapp/components/ContributionForm/#ContributionForm.vue# @@ -0,0 +1,623 @@ + + + + diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index c305b1fed..47841c717 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -286,30 +286,39 @@ export default { }, }, eventStart: { required: !!this.createEvent }, - eventVenue: { + eventVenue: { required: !!this.createEvent, min: 3, max: 100, validator: (_, value = '') => { + if (!this.createEvent) return [] if (!value.trim()) { return [new Error(this.$t('common.validations.eventVenueNotEmpty'))] } if (value.length < 3 || value.length > 100) { - return [new Error(this.$t('common.validations.eventVenueLength', { min: 3, max: 100 }))] + return [ + new Error(this.$t('common.validations.eventVenueLength', { min: 3, max: 100 })), + ] } return [] - }, }, + }, + }, eventLocationName: { required: !!this.createEvent && !this.formData.eventIsOnline, min: 3, max: 100, validator: (_, value = '') => { + if (!this.createEvent) return [] if (this.formData.eventIsOnline) return [] if (!value.trim()) { return [new Error(this.$t('common.validations.eventLocationNameNotEmpty'))] } if (value.length < 3 || value.length > 100) { - return [new Error(this.$t('common.validations.eventLocationNameLength', { min: 3, max: 100 }))] + return [ + new Error( + this.$t('common.validations.eventLocationNameLength', { min: 3, max: 100 }), + ), + ] } return [] },