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 {
await formRef.value?.validateFields()
} catch (e: any) {
e.errorFields.map((f: Record<string, any>) => message.error(f.errors.join(',')))
if (e.errorFields.length) return
if (e.errorFields.length) {
message.error(t('msg.error.someOfTheRequiredFieldsAreEmpty'))
return
}
}
await insertRow({
@ -832,7 +834,7 @@ useEventListener(
:rules="[
{
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)
const formColumns = computed(() =>
@ -191,6 +191,7 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
const submitForm = async () => {
try {
if (!(await v$.value?.$validate())) {
message.error(t('msg.error.someOfTheRequiredFieldsAreEmpty'))
return
}

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

@ -1379,14 +1379,15 @@
"theAcceptedFileTypesAreXlsXlsxXlsmOdsOts": "The accepted file types are .xls, .xlsx, .xlsm, .ods, .ots",
"parameterKeyCannotBeEmpty": "Parameter key cannot be empty",
"duplicateParameterKeysAreNotAllowed": "Duplicate parameter keys are not allowed",
"fieldRequired": "{value} cannot be empty.",
"fieldRequired": "{value} cannot be empty",
"projectNotAccessible": "Base not accessible",
"copyToClipboardError": "Failed to copy to clipboard",
"pasteFromClipboardError": "Failed to paste from clipboard",
"multiFieldSaveValidation": "Please complete the configuration of all fields before saving",
"somethingWentWrong": "Something went wrong",
"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": {
"exportMetadata": "Base metadata exported successfully",

Loading…
Cancel
Save