Show error pre-submit
This commit is contained in:
parent
cd47bc20a2
commit
3a9c90ac6b
|
@ -9,15 +9,23 @@
|
|||
|
||||
export let group
|
||||
export let saveGroup
|
||||
|
||||
let nameError
|
||||
</script>
|
||||
|
||||
<ModalContent
|
||||
onConfirm={() => saveGroup(group)}
|
||||
onConfirm={() => {
|
||||
if (!group.name?.trim()) {
|
||||
nameError = "Group name cannot be empty"
|
||||
return false
|
||||
}
|
||||
saveGroup(group)
|
||||
}}
|
||||
size="M"
|
||||
title={group?._rev ? "Edit group" : "Create group"}
|
||||
confirmText="Save"
|
||||
>
|
||||
<Input bind:value={group.name} label="Name" />
|
||||
<Input bind:value={group.name} label="Name" error={nameError} />
|
||||
<div class="modal-format">
|
||||
<div class="modal-inner">
|
||||
<Body size="XS">Icon</Body>
|
||||
|
|
Loading…
Reference in New Issue