Skip to content

Beautiful Open-Source Form Builder

More front-end bug fixes

Julien Nahume5dc3f1bd459
diff --git a/client/components/forms/PhoneInput.vue b/client/components/forms/PhoneInput.vue
index 014893bcc..297697beb 100644
--- a/client/components/forms/PhoneInput.vue
+++ b/client/components/forms/PhoneInput.vue
@@ -138,7 +138,7 @@ export default {
if(this.compVal === null){
return;
}
- if (!this.compVal.startsWith('+')) {
+ if (!this.compVal?.startsWith('+')) {
this.selectedCountryCode = this.getCountryBy(this.compVal.substring(2, 0))
}
diff --git a/client/components/forms/SelectInput.vue b/client/components/forms/SelectInput.vue
index e5cf34a91..9248c7519 100644
--- a/client/components/forms/SelectInput.vue
+++ b/client/components/forms/SelectInput.vue
@@ -32,7 +32,7 @@
<template v-if="multiple">
<div class="flex items-center truncate mr-6">
<span class="truncate">
- {{ selectedValues.join(', ') }}
+ {{ selectedValues?.join(', ') }}
</span>
</div>
</template>
@@ -122,6 +122,7 @@ export default {
return null
},
updateModelValue(newValues){
+ if (newValues === null) newValues = []
this.selectedValues = newValues
},
updateOptions (newItem) {
diff --git a/client/components/forms/SignatureInput.vue b/client/components/forms/SignatureInput.vue
index 3859127bf..d9dfeb6c2 100644
--- a/client/components/forms/SignatureInput.vue
+++ b/client/components/forms/SignatureInput.vue
@@ -53,7 +53,7 @@ export default {
if (this.disabled) {
this.$refs.signaturePad.clearSignature()
} else {
- const { isEmpty, data } = this.$refs.signaturePad.saveSignature()
+ const { isEmpty, data } = this.$refs.signaturePad?.saveSignature()
this.form[this.name] = (!isEmpty && data) ? data : null
}
}
diff --git a/client/components/global/WorkspaceDropdown.vue b/client/components/global/WorkspaceDropdown.vue
index ca8b2cceb..26212bf7e 100644
--- a/client/components/global/WorkspaceDropdown.vue
+++ b/client/components/global/WorkspaceDropdown.vue
@@ -23,7 +23,7 @@
<template v-for="worksp in workspaces" :key="worksp.id">
<a href="#"
class="px-4 py-2 text-md text-gray-700 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-100 dark:hover:text-white dark:hover:bg-gray-600 flex items-center"
- :class="{'bg-blue-100 dark:bg-blue-900':workspace.id === worksp.id}" @click.prevent="switchWorkspace(worksp)"
+ :class="{'bg-blue-100 dark:bg-blue-900':workspace?.id === worksp?.id}" @click.prevent="switchWorkspace(worksp)"
>
<div class="rounded-full h-8 w-8 flex-shrink-0" role="button">
<img v-if="isUrl(worksp.icon)"
diff --git a/client/components/open/forms/OpenForm.vue b/client/components/open/forms/OpenForm.vue
index 4d398b845..551cf415f 100644
--- a/client/components/open/forms/OpenForm.vue
+++ b/client/components/open/forms/OpenForm.vue
@@ -47,7 +47,7 @@
</open-form-button>
<slot v-if="isLastPage" name="submit-btn" :submitForm="submitForm" />
- <open-form-button v-else native-type="button" :color="form.color" :theme="theme" class="mt-2 px-8 mx-1"
+ <open-form-button v-else-if="currentFieldsPageBreak" native-type="button" :color="form.color" :theme="theme" class="mt-2 px-8 mx-1"
@click.stop="nextPage"
>
{{ currentFieldsPageBreak.next_btn_text }}
diff --git a/client/pages/forms/[slug]/edit.vue b/client/pages/forms/[slug]/edit.vue
index 4559a15a0..7b2f6a35d 100644
--- a/client/pages/forms/[slug]/edit.vue
+++ b/client/pages/forms/[slug]/edit.vue
@@ -56,7 +56,7 @@ function initUpdatedForm() {
// Create a form.id watcher that updates working form
watch(form, (form) => {
- if (form.value) {
+ if (form?.value) {
initUpdatedForm()
}
})
diff --git a/client/pages/home.vue b/client/pages/home.vue
index a0e5c088f..db7930544 100644
--- a/client/pages/home.vue
+++ b/client/pages/home.vue
@@ -157,7 +157,7 @@ const editForm = (form) => {
showEditFormModal.value = true
}
const onTagClick = (tag) => {
- if (selectedTags.value.has(tag)) {
+ if (selectedTags?.value?.has(tag)) {
selectedTags.value.remove(tag)
} else {
selectedTags.value.add(tag)
diff --git a/client/pages/settings/workspace.vue b/client/pages/settings/workspace.vue
index c71a1bd32..7da8ff933 100644
--- a/client/pages/settings/workspace.vue
+++ b/client/pages/settings/workspace.vue
@@ -159,7 +159,7 @@ const saveChanges = () => {
// Update the workspace custom domain
customDomainsForm.put('/open/workspaces/' + workspace.value.id + '/custom-domains', {
data: {
- custom_domains: customDomainsForm.custom_domains.split('\n')
+ custom_domains: customDomainsForm?.custom_domains?.split('\n')
.map(domain => domain ? domain.trim() : null)
.filter(domain => domain && domain.length > 0)
}
@@ -175,7 +175,7 @@ const saveChanges = () => {
const initCustomDomains = () => {
if (!workspace || !workspace.value.custom_domains) return
- customDomainsForm.custom_domains = workspace.value.custom_domains.join('\n')
+ customDomainsForm.custom_domains = workspace.value?.custom_domains.join('\n')
}
const deleteWorkspace = (workspaceId) => {