From 14e596c8a1be5fab765a41647e9c4390233f0116 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Fri, 25 Jul 2025 13:50:24 +0200 Subject: [PATCH] trigger validation on hover above submit button --- .../components/Contributions/ContributionForm.vue | 6 +++++- frontend/src/components/GddSend/TransactionForm.vue | 12 +++++++++++- frontend/src/components/Inputs/ValidatedInput.vue | 6 +++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/Contributions/ContributionForm.vue b/frontend/src/components/Contributions/ContributionForm.vue index cb2a31c09..0fc0fa05d 100644 --- a/frontend/src/components/Contributions/ContributionForm.vue +++ b/frontend/src/components/Contributions/ContributionForm.vue @@ -19,6 +19,7 @@ class="mb-4 bg-248" type="date" :rules="validationSchema.fields.contributionDate" + :disable-smart-valid-state="disableSmartValidState" @update:model-value="updateField" />
@@ -33,6 +34,7 @@ :placeholder="$t('contribution.yourActivity')" :rules="validationSchema.fields.memo" textarea="true" + :disable-smart-valid-state="disableSmartValidState" @update:model-value="updateField" /> - + ({ const form = reactive({ ...entityDataToForm.value }) const now = ref(new Date()) // checked every minute, updated if day, month or year changed +const disableSmartValidState = ref(false) const isThisMonth = computed(() => { const formContributionDate = new Date(form.contributionDate) diff --git a/frontend/src/components/GddSend/TransactionForm.vue b/frontend/src/components/GddSend/TransactionForm.vue index 4bf9d7229..c612b24be 100644 --- a/frontend/src/components/GddSend/TransactionForm.vue +++ b/frontend/src/components/GddSend/TransactionForm.vue @@ -63,6 +63,7 @@ :placeholder="$t('form.identifier')" :rules="validationSchema.fields.identifier" :disabled="isBalanceEmpty" + :disable-smart-valid-state="disableSmartValidState" @update:model-value="updateField" />
@@ -84,6 +85,7 @@ :placeholder="'0.01'" :rules="validationSchema.fields.amount" :disabled="isBalanceEmpty" + :disable-smart-valid-state="disableSmartValidState" @update:model-value="updateField" /> @@ -102,6 +104,7 @@ :rules="validationSchema.fields.memo" textarea="true" :disabled="isBalanceEmpty" + :disable-smart-valid-state="disableSmartValidState" @update:model-value="updateField" /> @@ -121,7 +124,13 @@ {{ $t('form.reset') }} - + {{ $t('form.check_now') }} @@ -161,6 +170,7 @@ const props = defineProps({ const entityDataToForm = computed(() => ({ ...props })) const form = reactive({ ...entityDataToForm.value }) +const disableSmartValidState = ref(false) const emit = defineEmits(['set-transaction']) diff --git a/frontend/src/components/Inputs/ValidatedInput.vue b/frontend/src/components/Inputs/ValidatedInput.vue index bbd998635..67362131d 100644 --- a/frontend/src/components/Inputs/ValidatedInput.vue +++ b/frontend/src/components/Inputs/ValidatedInput.vue @@ -39,6 +39,10 @@ const props = defineProps({ type: Object, required: true, }, + disableSmartValidState: { + type: Boolean, + default: false, + }, }) const { t } = useI18n() @@ -61,7 +65,7 @@ const valid = computed(() => props.rules.isValidSync(model.value)) // After first blur: // - show true or false according to the validation result const smartValidState = computed(() => { - if (afterFirstInput.value) { + if (afterFirstInput.value || props.disableSmartValidState) { return valid.value } return valid.value ? true : null