From 8e204ae0b8fa4519745f5ddb622c0b1693ee76c0 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 14 Apr 2022 09:46:36 +0100 Subject: [PATCH] Add on change action to boolean field --- .../src/components/app/forms/BooleanField.svelte | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/client/src/components/app/forms/BooleanField.svelte b/packages/client/src/components/app/forms/BooleanField.svelte index 1e3bc2fc8c..b9c69ce684 100644 --- a/packages/client/src/components/app/forms/BooleanField.svelte +++ b/packages/client/src/components/app/forms/BooleanField.svelte @@ -9,6 +9,7 @@ export let size export let validation export let defaultValue + export let onChange let fieldState let fieldApi @@ -25,6 +26,13 @@ } return false } + + const handleChange = e => { + fieldApi.setValue(e.detail) + if (onChange) { + onChange({ value: e.detail }) + } + } fieldApi.setValue(e.detail)} {text} + on:change={handleChange} /> {/if}