From 9b56dcfdfef89e4e4e75cf82953d1ffa17f7455b Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 14 Apr 2022 09:46:24 +0100 Subject: [PATCH] Add on change action to attachment field --- .../src/components/app/forms/AttachmentField.svelte | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/client/src/components/app/forms/AttachmentField.svelte b/packages/client/src/components/app/forms/AttachmentField.svelte index 679dfa9702..5b2eab0c42 100644 --- a/packages/client/src/components/app/forms/AttachmentField.svelte +++ b/packages/client/src/components/app/forms/AttachmentField.svelte @@ -8,6 +8,7 @@ export let disabled = false export let validation export let extensions + export let onChange let fieldState let fieldApi @@ -38,6 +39,13 @@ return [] } } + + const handleChange = e => { + fieldApi.setValue(e.detail) + if (onChange) { + onChange({ value: e.detail }) + } + } { - fieldApi.setValue(e.detail) - }} + on:change={handleChange} {processFiles} {handleFileTooLarge} {extensions}