Category : validation

In the project, required, max-size-number, min-size-number parts work, but pattern, minlength, and maxlength parts dont work, How can I correct this? here is the related code part; <div ng-if="componentValidationType[component.shortName] == validationType.VALIDATION"> <div style="color: red" ng-messages="getFormValidations(form.shortName)[‘name’+component.shortName].$error" ng-show="isInAdminFormPage && formInf.mainForm.$submitted"> <div ng-message="required" >{{message["required"]}}</div> <div ng-message="minlength">{{message["minlength"]}}</div> <div ng-message="maxlength">{{message["maxlength"]}}</div> <div ng-message="ng-pattern">{{message["ng-pattern"]}}</div> </div> <div ng-if="isInAdminFormPage" style="color: orange" ng-show="showValidationMessageOfTextBox(component.shortName) && formInf.mainForm.$submitted"> ..

Read more

I’m implementing a validator to check which lines have the same name. I want to display an error message saying: "This line is duplicated" below the input box. Now I’m customizing the FormArray validation so that it shows the error message line by line but don’t know what to do next. In app.component.html file: <h4 ..

Read more

I have a simple input, I would like to get the type of error at submit. formGroup: FormGroup = this.fb.group({ password: [ ”, [Validators.required, Validators.minLength(8), SpecialCharacters], ], }); For example: onSubmit(): void { if (this.formGroup.invalid) { //I get the type of error: //number of characters less than 8 //you have not entered any special characters ..

Read more

The following regex doesn’t match with a url like: https:/!313www.google.com in online sandbox environments such as regexr.com and regex101.com, which is the expected behaviour. however, when using this same regex in angular to validate urls in a reactive form, the regex matches with the above url (i.e. validates it). It seems to validate a url ..

Read more

I want the submit button for my form to be blank when there is no input. But my problem is the submit only blanks out, when you put input, than delete it. html template Titel Titel darf nicht leer sein <label for="link">Link (Optional)</label> <input #link type="text" formControlName="link" class="form-control" id="link" placeholder="Link"> <label for="description">Beschreibung</label> <div class="input-group"> <textarea ..

Read more

I am trying to set conditional validation within a angular form group. My goal is to not check for validation if the forms are empty (therefore they will be valid if left untouched). And then if they are used (something is entered, I want to then validate the input). What I have so far is: ..

Read more