From c695ffe9d24e5807d4825d3e76ec01f8d810d950 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Wed, 13 Nov 2024 18:59:48 +0800 Subject: [PATCH] fix: fix update record form validation --- .../components/blocks/record-detail/record-detail.svelte | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/frontend/src/lib/components/blocks/record-detail/record-detail.svelte b/apps/frontend/src/lib/components/blocks/record-detail/record-detail.svelte index 194241b7e..a9cb506a2 100644 --- a/apps/frontend/src/lib/components/blocks/record-detail/record-detail.svelte +++ b/apps/frontend/src/lib/components/blocks/record-detail/record-detail.svelte @@ -80,6 +80,12 @@ validators: zodClient(schema), resetForm: false, invalidateAll: false, + onSubmit(input) { + validateForm({ update: true }) + }, + onChange(event) { + validateForm({ update: true }) + }, onUpdate(event) { if (!event.form.valid) { return @@ -93,7 +99,7 @@ }, }) - const { form: formData, enhance, allErrors, tainted, reset, errors } = form + const { form: formData, enhance, allErrors, tainted, reset, errors, validateForm } = form $: mutableFields = fields.filter((f) => f.isMutable) $: taintedKeys = Object.keys($tainted ?? {})