diff --git a/src/composables/useValidator.js b/src/composables/useValidator.js index a07f3e985..7a7032608 100644 --- a/src/composables/useValidator.js +++ b/src/composables/useValidator.js @@ -46,6 +46,9 @@ export function useValidator() { return !validator.isEmpty(value ? String(value) : '') || message; }, + required: (required, value) => { + return required ? !!value || t('globals.fieldRequired') : null; + }, length: (value) => { const options = { min: validation.min || validation.is, @@ -78,11 +81,9 @@ export function useValidator() { custom: (value) => validation.bindedFunction(value) || 'Invalid value', }; }; - // const requiredFieldRule = [(val) => validations({}).presence(val)]; return { validate, - // requiredFieldRule, validations, models, }; diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 84a0f3edc..9bcb3f921 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -67,6 +67,7 @@ globals: allRows: 'All { numberRows } row(s)' markAll: Mark all requiredField: Required field + valueCantBeEmpty: Value cannot be empty class: clase type: Type reason: reason @@ -75,7 +76,7 @@ globals: notificationSent: Notification sent warehouse: Warehouse company: Company - fieldRequired: Field requdired + fieldRequired: Field required allowedFilesText: 'Allowed file types: { allowedContentTypes }' smsSent: SMS sent confirmDeletion: Confirm deletion