From 0916ce7af2d9296971ff9b7c818d80d0939c480c Mon Sep 17 00:00:00 2001 From: puriphatt Date: Fri, 23 May 2025 11:40:22 +0700 Subject: [PATCH] fix: enhance validation rules for agency and employer name fields --- .../FormBasicInfoAgencies.vue | 16 +++++++++++++++- .../components/employer/EmployerFormAbout.vue | 15 ++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/components/07_agencies-management/FormBasicInfoAgencies.vue b/src/components/07_agencies-management/FormBasicInfoAgencies.vue index 7f3f3c5d..1d80f5c3 100644 --- a/src/components/07_agencies-management/FormBasicInfoAgencies.vue +++ b/src/components/07_agencies-management/FormBasicInfoAgencies.vue @@ -68,7 +68,12 @@ type Options = { label: string; value: string }; class="col-md-4 col-12" :label="$t('agencies.name')" v-model="name" - :rules="[(val: string) => !!val || $t('form.error.required')]" + :rules="[ + (val) => !!val || $t('form.error.required'), + (val) => + /^[A-Za-z0-9ก-๙\s&.,'-]+$/.test(val) || + $t('form.error.branchNameField'), + ]" /> (typeof v === 'string' ? (registerNameEN = v.trim()) : '') " :rules="[ - (val: string) => - val === '' || - /^[0-9A-Za-z\s.,]+$/.test(val) || - $t('form.error.letterOnly'), + (val) => !!val || $t('form.error.required'), + (val) => + /^[A-Za-z0-9\s&.,'-]+$/.test(val) || + $t('form.error.branchNameENField'), ]" />