From f1052409c0945d076df1345d0294e320c7da9250 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Fri, 25 Jul 2025 12:29:43 +0200 Subject: [PATCH] make validation smart, show invalid after first onBlur --- .../components/GddSend/TransactionForm.vue | 2 +- .../src/components/Inputs/ValidatedInput.vue | 40 +++++++++++++++++-- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/GddSend/TransactionForm.vue b/frontend/src/components/GddSend/TransactionForm.vue index 5ce9b6e7f..4bf9d7229 100644 --- a/frontend/src/components/GddSend/TransactionForm.vue +++ b/frontend/src/components/GddSend/TransactionForm.vue @@ -178,7 +178,7 @@ const validationSchema = computed(() => { amount: number() .required() .transform((value, originalValue) => { - if (typeof originalValue === 'string' && originalValue !== '') { + if (typeof originalValue === 'string') { return Number(originalValue.replace(',', '.')) } return value diff --git a/frontend/src/components/Inputs/ValidatedInput.vue b/frontend/src/components/Inputs/ValidatedInput.vue index 04c346292..8f4601124 100644 --- a/frontend/src/components/Inputs/ValidatedInput.vue +++ b/frontend/src/components/Inputs/ValidatedInput.vue @@ -9,7 +9,8 @@ :required="!isOptional" :label="label" :name="name" - :state="valid" + :state="smartValidState" + @blur="afterFirstInput = true" @update:modelValue="updateValue" > @@ -19,7 +20,7 @@ + +