diff --git a/packages/nc-gui-v2/components/smartsheet/Form.vue b/packages/nc-gui-v2/components/smartsheet/Form.vue index 29a8acc488..fb551e90b7 100644 --- a/packages/nc-gui-v2/components/smartsheet/Form.vue +++ b/packages/nc-gui-v2/components/smartsheet/Form.vue @@ -25,15 +25,7 @@ const { $api, $e } = useNuxtApp() const { isUIAllowed } = useUIPermission() -const formState = reactive({ - heading: '', - subheading: '', - submit_another_form: false, - show_blank_form: false, - email: false, - success_msg: '', - fields: {}, -}) +const formState = reactive({}) const isEditable = isUIAllowed('editFormView' as Permission) @@ -53,6 +45,7 @@ const { formViewData, changePage, updateRowProperty, + updateFormView, } = useViewData(meta, view as any) const { showAll, hideAll, saveOrUpdate } = useViewColumns(view, meta as any, false, async () => { @@ -82,7 +75,14 @@ const activeRow = ref('') const formView = ref({}) -function updateView() {} +function updateView() { + if ((formViewData.value?.subheading?.length || 0) > 255) { + toast.error('Data too long for Form Description') + return + } + + updateFormView(formViewData.value) +} async function submitForm() { try { @@ -121,7 +121,7 @@ function isDbRequired(column: Record) { string, any > - if ((col.rqd && !col.default) || (formState as Record)?.fields[column.title]?.required) { + if (col.rqd && !col.default) { isRequired = true } } @@ -201,20 +201,6 @@ async function removeAllColumns() { async function checkSMTPStatus() {} function setFormData() { - Object.assign(formState, { - heading: formViewData.value?.heading, - subheading: formViewData.value?.subheading, - submit_another_form: !!formViewData.value?.submit_another_form, - show_blank_form: !!formViewData.value?.email, - email: formViewData.value?.submit_another_form, - success_msg: formViewData.value?.success_msg, - fields: (formColumnData.value as Record[])?.map((c) => ({ - [c.title]: { - required: false, - }, - })), - }) - const col = (formColumnData as Record)?.value localColumns.value = col @@ -346,33 +332,34 @@ onMounted(async () => { - +
@@ -475,24 +462,28 @@ onMounted(async () => { - +
- + {{ $t('msg.info.submitAnotherForm') }}
- + {{ $t('msg.info.showBlankForm') }}
- + {{ $t('msg.info.emailForm') }} {{ state.user.value?.email }}