forked from verdnatura/salix-front
feat: required validation
This commit is contained in:
parent
8798598f41
commit
fb2e3f1f9c
|
@ -46,6 +46,9 @@ export function useValidator() {
|
||||||
|
|
||||||
return !validator.isEmpty(value ? String(value) : '') || message;
|
return !validator.isEmpty(value ? String(value) : '') || message;
|
||||||
},
|
},
|
||||||
|
required: (required, value) => {
|
||||||
|
return required ? !!value || t('globals.fieldRequired') : null;
|
||||||
|
},
|
||||||
length: (value) => {
|
length: (value) => {
|
||||||
const options = {
|
const options = {
|
||||||
min: validation.min || validation.is,
|
min: validation.min || validation.is,
|
||||||
|
@ -78,11 +81,9 @@ export function useValidator() {
|
||||||
custom: (value) => validation.bindedFunction(value) || 'Invalid value',
|
custom: (value) => validation.bindedFunction(value) || 'Invalid value',
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
// const requiredFieldRule = [(val) => validations({}).presence(val)];
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
validate,
|
validate,
|
||||||
// requiredFieldRule,
|
|
||||||
validations,
|
validations,
|
||||||
models,
|
models,
|
||||||
};
|
};
|
||||||
|
|
|
@ -67,6 +67,7 @@ globals:
|
||||||
allRows: 'All { numberRows } row(s)'
|
allRows: 'All { numberRows } row(s)'
|
||||||
markAll: Mark all
|
markAll: Mark all
|
||||||
requiredField: Required field
|
requiredField: Required field
|
||||||
|
valueCantBeEmpty: Value cannot be empty
|
||||||
class: clase
|
class: clase
|
||||||
type: Type
|
type: Type
|
||||||
reason: reason
|
reason: reason
|
||||||
|
@ -75,7 +76,7 @@ globals:
|
||||||
notificationSent: Notification sent
|
notificationSent: Notification sent
|
||||||
warehouse: Warehouse
|
warehouse: Warehouse
|
||||||
company: Company
|
company: Company
|
||||||
fieldRequired: Field requdired
|
fieldRequired: Field required
|
||||||
allowedFilesText: 'Allowed file types: { allowedContentTypes }'
|
allowedFilesText: 'Allowed file types: { allowedContentTypes }'
|
||||||
smsSent: SMS sent
|
smsSent: SMS sent
|
||||||
confirmDeletion: Confirm deletion
|
confirmDeletion: Confirm deletion
|
||||||
|
|
Loading…
Reference in New Issue