mirror of
https://github.com/ansible/awx.git
synced 2026-02-28 16:28:43 -03:30
refactor out OrganizationForm; share between add & edit
This commit is contained in:
19
src/util/validators.js
Normal file
19
src/util/validators.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { i18nMark } from '@lingui/react';
|
||||
|
||||
export function required (message) {
|
||||
return value => {
|
||||
if (!value.trim()) {
|
||||
return message || i18nMark('This field must not be blank');
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
}
|
||||
|
||||
export function maxLength (max) {
|
||||
return value => {
|
||||
if (value.trim() > max) {
|
||||
return i18nMark(`This field must not exceed ${max} characters`);
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user