Browse Source

fic(nc-gui): update form submit error message

pull/7664/head
Ramesh Mane 9 months ago
parent
commit
5537cde5b9
  1. 8
      packages/nc-gui/components/smartsheet/Form.vue
  2. 3
      packages/nc-gui/composables/useSharedFormViewStore.ts
  3. 5
      packages/nc-gui/lang/en.json

8
packages/nc-gui/components/smartsheet/Form.vue

@ -142,8 +142,10 @@ async function submitForm() {
try { try {
await formRef.value?.validateFields() await formRef.value?.validateFields()
} catch (e: any) { } catch (e: any) {
e.errorFields.map((f: Record<string, any>) => message.error(f.errors.join(','))) if (e.errorFields.length) {
if (e.errorFields.length) return message.error(t('msg.error.someOfTheRequiredFieldsAreEmpty'))
return
}
} }
await insertRow({ await insertRow({
@ -832,7 +834,7 @@ useEventListener(
:rules="[ :rules="[
{ {
required: isRequired(element, element.required), required: isRequired(element, element.required),
message: `${$t('msg.error.fieldRequired', { value: 'This Field' })}`, message: `${$t('msg.error.fieldRequired', { value: 'This field' })}`,
}, },
]" ]"
> >

3
packages/nc-gui/composables/useSharedFormViewStore.ts

@ -76,7 +76,7 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
}), }),
) )
const fieldRequired = (fieldName = 'This Field') => const fieldRequired = (fieldName = 'This field') =>
helpers.withMessage(t('msg.error.fieldRequired', { value: fieldName }), required) helpers.withMessage(t('msg.error.fieldRequired', { value: fieldName }), required)
const formColumns = computed(() => const formColumns = computed(() =>
@ -191,6 +191,7 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
const submitForm = async () => { const submitForm = async () => {
try { try {
if (!(await v$.value?.$validate())) { if (!(await v$.value?.$validate())) {
message.error(t('msg.error.someOfTheRequiredFieldsAreEmpty'))
return return
} }

5
packages/nc-gui/lang/en.json

@ -1379,14 +1379,15 @@
"theAcceptedFileTypesAreXlsXlsxXlsmOdsOts": "The accepted file types are .xls, .xlsx, .xlsm, .ods, .ots", "theAcceptedFileTypesAreXlsXlsxXlsmOdsOts": "The accepted file types are .xls, .xlsx, .xlsm, .ods, .ots",
"parameterKeyCannotBeEmpty": "Parameter key cannot be empty", "parameterKeyCannotBeEmpty": "Parameter key cannot be empty",
"duplicateParameterKeysAreNotAllowed": "Duplicate parameter keys are not allowed", "duplicateParameterKeysAreNotAllowed": "Duplicate parameter keys are not allowed",
"fieldRequired": "{value} cannot be empty.", "fieldRequired": "{value} cannot be empty",
"projectNotAccessible": "Base not accessible", "projectNotAccessible": "Base not accessible",
"copyToClipboardError": "Failed to copy to clipboard", "copyToClipboardError": "Failed to copy to clipboard",
"pasteFromClipboardError": "Failed to paste from clipboard", "pasteFromClipboardError": "Failed to paste from clipboard",
"multiFieldSaveValidation": "Please complete the configuration of all fields before saving", "multiFieldSaveValidation": "Please complete the configuration of all fields before saving",
"somethingWentWrong": "Something went wrong", "somethingWentWrong": "Something went wrong",
"draggedContentIsNotTypeOfImage": "Dragged content is not type of image", "draggedContentIsNotTypeOfImage": "Dragged content is not type of image",
"fieldToParseImageData": "Field to parse image data" "fieldToParseImageData": "Field to parse image data",
"someOfTheRequiredFieldsAreEmpty": "Some of the required fields are empty"
}, },
"toast": { "toast": {
"exportMetadata": "Base metadata exported successfully", "exportMetadata": "Base metadata exported successfully",

Loading…
Cancel
Save