From 5d2c337d5df6be4b800628eea5b513a287f8b75b Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 14 Apr 2022 09:47:27 +0100 Subject: [PATCH] Add on change action to string field --- .../src/components/app/forms/StringField.svelte | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/client/src/components/app/forms/StringField.svelte b/packages/client/src/components/app/forms/StringField.svelte index bb598bb1e0..fcdcfdc099 100644 --- a/packages/client/src/components/app/forms/StringField.svelte +++ b/packages/client/src/components/app/forms/StringField.svelte @@ -10,9 +10,17 @@ export let validation export let defaultValue = "" export let align + export let onChange let fieldState let fieldApi + + const handleChange = e => { + fieldApi.setValue(e.detail) + if (onChange) { + onChange({ value: e.detail }) + } + } fieldApi.setValue(e.detail)} + on:change={handleChange} disabled={fieldState.disabled} error={fieldState.error} id={fieldState.fieldId}