diff --git a/src/views/FormBuilder.svelte b/src/views/FormBuilder.svelte index 0372f633..4ae67565 100644 --- a/src/views/FormBuilder.svelte +++ b/src/views/FormBuilder.svelte @@ -4,6 +4,7 @@ type FormDefinition, isValidFormDefinition, FieldTypeReadable, + validateFields, } from "src/core/formDefinition"; import { FolderSuggest } from "src/suggesters/suggestFolder"; import { setIcon, Setting, App } from "obsidian"; @@ -24,6 +25,7 @@ export let onPreview: (formDefinition: FormDefinition) => void; $: isValid = isValidFormDefinition(definition); + $: errors = validateFields(definition.fields); function folderField(element: HTMLElement, index: number) { const field = definition.fields[index]; @@ -143,6 +145,22 @@ >Cancel + {#if errors.length > 0} +

+ Form is invalid, check the + following: +

+ + {/if}
@@ -396,6 +414,10 @@ .hint { color: var(--color-base-70); } + .error { + color: var(--text-error); + font-weight: bold; + } button:disabled { opacity: 0.5; cursor: forbidden;