diff --git a/dashboard/src/components/AppImportDialog.vue b/dashboard/src/components/AppImportDialog.vue index 9be5d5766..e5682a4bb 100644 --- a/dashboard/src/components/AppImportDialog.vue +++ b/dashboard/src/components/AppImportDialog.vue @@ -25,8 +25,8 @@ const encryptionPassword = ref(''); const encryptedFilenames = ref(false); const isFormValid = ref(false); -function validateForm() { - isFormValid.value = form.value && form.value.checkValidity(); +function checkValidity() { + isFormValid.value = form.value ? form.value.checkValidity() : false; } async function onSubmit() { @@ -251,7 +251,7 @@ function onBackupConfigChanged(event) { } } - setTimeout(validateForm, 100); // update state of the confirm button + setTimeout(checkValidity, 100); // update state of the confirm button }; reader.readAsText(event.target.files[0]); @@ -262,7 +262,7 @@ function onUploadBackupConfig() { } watchEffect(() => { - if (providerConfig.value.credentials) setTimeout(validateForm, 100); + if (providerConfig.value.credentials) setTimeout(checkValidity, 100); }); defineExpose({ @@ -310,7 +310,7 @@ defineExpose({

-
+
diff --git a/dashboard/src/components/BackupSiteAddDialog.vue b/dashboard/src/components/BackupSiteAddDialog.vue index 608925742..1a644066b 100644 --- a/dashboard/src/components/BackupSiteAddDialog.vue +++ b/dashboard/src/components/BackupSiteAddDialog.vue @@ -16,7 +16,6 @@ const backupSitesModel = BackupSitesModel.create(); const systemModel = SystemModel.create(); const dialog = useTemplateRef('dialog'); -const form = useTemplateRef('form'); const step = ref('storage'); const newSiteId = ref(''); const name = ref(''); @@ -227,10 +226,10 @@ function onCancel() { dialog.value.close(); } -const isValid = ref(false); - +const form = useTemplateRef('form'); +const isFormValid = ref(false); function checkValidity() { - isValid.value = form.value.checkValidity(); + isFormValid.value = form.value ? form.value.checkValidity() : false; } defineExpose({ @@ -301,7 +300,7 @@ defineExpose({
- + @@ -378,7 +377,7 @@ defineExpose({
- +
diff --git a/dashboard/src/components/DockerRegistryDialog.vue b/dashboard/src/components/DockerRegistryDialog.vue index 8c4faa8c4..9a9b6bf77 100644 --- a/dashboard/src/components/DockerRegistryDialog.vue +++ b/dashboard/src/components/DockerRegistryDialog.vue @@ -37,7 +37,7 @@ const password = ref(''); const form = useTemplateRef('form'); const isFormValid = ref(false); function checkValidity() { - isFormValid.value = form.value.checkValidity(); + isFormValid.value = form.value ? form.value.checkValidity() : false; } async function onSubmit() { diff --git a/dashboard/src/components/DomainDialog.vue b/dashboard/src/components/DomainDialog.vue index fdedf4f85..e9c169da6 100644 --- a/dashboard/src/components/DomainDialog.vue +++ b/dashboard/src/components/DomainDialog.vue @@ -31,7 +31,7 @@ const dnsConfig = ref(DomainsModel.createEmptyConfig()); const form = useTemplateRef('form'); const isFormValid = ref(false); function checkValidity() { - isFormValid.value = form.value.checkValidity(); + isFormValid.value = form.value ? form.value.checkValidity() : false; } async function onSubmit() { diff --git a/dashboard/src/components/ExternalLdap.vue b/dashboard/src/components/ExternalLdap.vue index d94699bbc..d432a31f7 100644 --- a/dashboard/src/components/ExternalLdap.vue +++ b/dashboard/src/components/ExternalLdap.vue @@ -49,7 +49,7 @@ const autoCreate = ref(false); const form = useTemplateRef('form'); const isFormValid = ref(false); function checkValidity() { - isFormValid.value = form.value.checkValidity(); + isFormValid.value = form.value ? form.value.checkValidity() : false; } function onProviderChange() { diff --git a/dashboard/src/components/MailRelaySettingsItem.vue b/dashboard/src/components/MailRelaySettingsItem.vue index 55431ef14..cabedd8d2 100644 --- a/dashboard/src/components/MailRelaySettingsItem.vue +++ b/dashboard/src/components/MailRelaySettingsItem.vue @@ -54,7 +54,7 @@ function usesPasswordAuth(provider) { const form = useTemplateRef('form'); const isFormValid = ref(false); function checkValidity() { - isFormValid.value = form.value.checkValidity(); + isFormValid.value = form.value ? form.value.checkValidity() : false; } function onProviderChange() { @@ -97,6 +97,8 @@ async function onShowDialog() { } async function onSubmit() { + if (!form.value.reportValidity()) return; + busy.value = true; formError.value = ''; diff --git a/dashboard/src/components/MailboxDialog.vue b/dashboard/src/components/MailboxDialog.vue index 3d95d4912..ace6b842e 100644 --- a/dashboard/src/components/MailboxDialog.vue +++ b/dashboard/src/components/MailboxDialog.vue @@ -47,7 +47,7 @@ async function onRemoveAlias(index) { const form = useTemplateRef('form'); const isFormValid = ref(false); function validateForm() { - isFormValid.value = form.value && form.value.checkValidity(); + isFormValid.value = form.value ? form.value.checkValidity() : false; } async function onSubmit() { diff --git a/dashboard/src/components/SetupAccount.vue b/dashboard/src/components/SetupAccount.vue index a7ca4bfca..fc90c1fbf 100644 --- a/dashboard/src/components/SetupAccount.vue +++ b/dashboard/src/components/SetupAccount.vue @@ -38,7 +38,7 @@ watch(password, () => { const isFormValid = ref(false); function validateForm() { - isFormValid.value = form.value.checkValidity(); + isFormValid.value = form.value ? form.value.checkValidity() : false; if (isFormValid.value) { if (password.value !== passwordRepeat.value) isFormValid.value = false; diff --git a/dashboard/src/components/UserDialog.vue b/dashboard/src/components/UserDialog.vue index 70c190713..c0bf68601 100644 --- a/dashboard/src/components/UserDialog.vue +++ b/dashboard/src/components/UserDialog.vue @@ -53,7 +53,7 @@ function onAvatarChanged(file) { const isFormValid = ref(false); function validateForm() { - isFormValid.value = form.value && form.value.checkValidity(); + isFormValid.value = form.value ? form.value.checkValidity() : false; } async function onSubmit() { diff --git a/dashboard/src/views/RestoreView.vue b/dashboard/src/views/RestoreView.vue index dca885c09..8f652893a 100644 --- a/dashboard/src/views/RestoreView.vue +++ b/dashboard/src/views/RestoreView.vue @@ -46,7 +46,7 @@ const siteId = ref(''); const form = useTemplateRef('form'); const isFormValid = ref(false); function checkValidity() { - isFormValid.value = form.value.checkValidity(); + isFormValid.value = form.value ? form.value.checkValidity() : false; } async function waitForRestore () { @@ -81,7 +81,7 @@ async function waitForRestore () { } async function onSubmit() { - if (!isFormValid.value) return; + if (!form.value.reportValidity()) return; busy.value = true; formError.value = {}; diff --git a/dashboard/src/views/SetupView.vue b/dashboard/src/views/SetupView.vue index a190ff874..785f2acf6 100644 --- a/dashboard/src/views/SetupView.vue +++ b/dashboard/src/views/SetupView.vue @@ -44,7 +44,7 @@ const ipv6Interface = ref(''); const form = useTemplateRef('form'); const isFormValid = ref(false); function checkValidity() { - isFormValid.value = form.value.checkValidity(); + isFormValid.value = form.value ? form.value.checkValidity() : false; } async function waitForDnsSetup () { @@ -74,7 +74,7 @@ async function waitForDnsSetup () { } async function onSubmit() { - if (!isFormValid.value) return; + if (!form.value.reportValidity()) return; busy.value = true; formError.value = {};