From 7b7f44620dbd86e01de1974021298fab980302c5 Mon Sep 17 00:00:00 2001 From: supalerk-ar66 Date: Wed, 11 Feb 2026 10:21:58 +0700 Subject: [PATCH] feat: add user registration page with form validation and API integration. --- Frontend-Learner/pages/auth/register.vue | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Frontend-Learner/pages/auth/register.vue b/Frontend-Learner/pages/auth/register.vue index 252120c6..8d05a4d3 100644 --- a/Frontend-Learner/pages/auth/register.vue +++ b/Frontend-Learner/pages/auth/register.vue @@ -103,13 +103,9 @@ const onUsernameInput = (val: string | number | null) => { }; const onPhoneInput = (val: string | number | null) => { - const value = String(val || '') + const value = String(val || '').replace(/\D/g, '').slice(0, 10) registerForm.phone = value; - if (/\D/.test(value)) { - errors.value.phone = 'กรุณากรอกเฉพาะตัวเลข'; - } else { - if (errors.value.phone === 'กรุณากรอกเฉพาะตัวเลข') clearFieldError('phone'); - } + if (errors.value.phone === 'กรุณากรอกเฉพาะตัวเลข') clearFieldError('phone'); }; const onEmailInput = (val: string | number | null) => { @@ -315,6 +311,7 @@ const handleRegister = async () => { :value="registerForm.phone" @input="(e) => onPhoneInput((e.target as HTMLInputElement).value)" type="tel" + maxlength="10" class="w-full h-12 pl-12 pr-4 rounded-xl bg-slate-50 border border-slate-200 text-slate-900 placeholder-slate-400 text-base focus:outline-none focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 transition-all font-medium" :class="{'border-red-500 focus:ring-red-500/20 focus:border-red-500': errors.phone}" />