diff options
Diffstat (limited to 'client/src/app/shared/form-validators')
-rw-r--r-- | client/src/app/shared/form-validators/video-validators.ts | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/client/src/app/shared/form-validators/video-validators.ts b/client/src/app/shared/form-validators/video-validators.ts index 0000f18ba..1382a7747 100644 --- a/client/src/app/shared/form-validators/video-validators.ts +++ b/client/src/app/shared/form-validators/video-validators.ts | |||
@@ -3,15 +3,14 @@ import { BuildFormValidator } from './form-validator.model' | |||
3 | 3 | ||
4 | export const trimValidator: ValidatorFn = (control: FormControl) => { | 4 | export const trimValidator: ValidatorFn = (control: FormControl) => { |
5 | if (control.value.startsWith(' ') || control.value.endsWith(' ')) { | 5 | if (control.value.startsWith(' ') || control.value.endsWith(' ')) { |
6 | return { | 6 | return { spaces: true } |
7 | 'spaces': true | ||
8 | } | ||
9 | } | 7 | } |
10 | return null; | 8 | |
11 | }; | 9 | return null |
10 | } | ||
12 | 11 | ||
13 | export const VIDEO_NAME_VALIDATOR: BuildFormValidator = { | 12 | export const VIDEO_NAME_VALIDATOR: BuildFormValidator = { |
14 | VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(120), trimValidator ], | 13 | VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(120) ], |
15 | MESSAGES: { | 14 | MESSAGES: { |
16 | 'required': $localize`Video name is required.`, | 15 | 'required': $localize`Video name is required.`, |
17 | 'minlength': $localize`Video name must be at least 3 characters long.`, | 16 | 'minlength': $localize`Video name must be at least 3 characters long.`, |