All Questions
Tagged with angular-validation javascript
41 questions
1
vote
2answers
56 views
Cross field validation doesn't work in Angular
I have two date fields in two separate components. I set validations on the effective date to validate if effective date is earlier than application date. If it's earlier than application date, error ...
-1
votes
2answers
60 views
Any simple way to apply one validation rule to all fields by Angular 6
Consider a data model contains 20 string fields with different name ("name", "address", "company".. etc ), mapped to Angular front end as 20 input fields. Now the requirement asks to validate each ...
0
votes
1answer
275 views
confirm validation directive is not working in angular 6
I am trying to validate confirm password using template driven in angular 6.
I written custom directive to check password and confirm password but its not working.
custom directive selector "...
12
votes
0answers
284 views
Inconsistent validation issue in Angular custom component
To show a kind of real world example, let's say that we want to use the @angular/material's datepicker in our application.
We want to use it on a lot of pages, so we want to make it very easy to add ...
0
votes
0answers
28 views
Validate only one field ng-required angularjs
How to validate only one field in form with different button-click rather that submit button?
<textarea class="form-control" rows="2" ng-model="vm.foo" ng-required="true"></textarea>
<...
0
votes
3answers
2k views
Angular - assign custom validator to a FormGroup
I need to assign a custom validator to a FormGroup. I can do this at the time the FormGroup is created like this:
let myForm : FormGroup;
myForm = this.formBuilder.group({
myControl1: ...
1
vote
3answers
220 views
Angular 4 - cannot read property status of null while displaying validation error
I am trying to display validation errors for FormArray, I have contact_number and contact_name in the array. The fields are getting added dynamically successfully but when they are invalid then I need ...
0
votes
0answers
52 views
Angular 5: custom async validator freezes browsers
I've a custom async validator that freezes my app. Tested in Chrome and Firefox.
It happens after typing approx. 30 chars, which means the Validator was called approx. 30 times.
Looks like the ...
1
vote
0answers
122 views
Angular custom validator directive issue
I am having some troubles with my custom directive and it doesn't seem to be registered for some reason. I have added the following custom directive into app.module's declarations array. So I guess it ...
5
votes
1answer
3k views
Expected validator to return Promise or Observable
Im trying to do a custom validation on Angular 5 but I'm facing the following error
Expected validator to return Promise or Observable
I just want to return an error to the form if the value doesnt ...
0
votes
0answers
30 views
Is it possible to fire an event only once if any part of an Angular form element comes into focus?
I'm working with Angular forms and trying to see if there is a better way to fire an event on the first initial focus of any cell within a form. This way the event only gets called once.
I am aware ...
2
votes
1answer
101 views
Validating UK PostCode with JavaScript Reg for Angular5 app
I am working on Angular 5 Reactive Form validation and trying to validate UK PostCode using custom validation function which is working and testing apart from in case provide extra letter or numeric ...
1
vote
1answer
1k views
Angular reactive forms - manually trigger validation of parent FormGroup when child FormGroup changes
I have an Angular component that defines an FormGroup, which has a nested FormGroup as one of its controls.
The child FormGroup is passed as an @Input parameter to a child component, and there are ...
2
votes
1answer
29 views
how to validate form in angular 2 having one input field?
I have one input field in which user can enter email as well as 10 digit phone number if any of this condition is fulfill i want to enable continue button . I am able to enable button when user type ...
4
votes
2answers
1k views
Reactive Angular form to wait for async validator complete on submit
I am building a reactive angular form and I'm trying to find a way to trigger all validators on submit. If the validor is a sync one, it'd be ok, as I can get the status of it inline. Otherwise, if ...
-1
votes
2answers
277 views
Checkbox group, submit button only if at least one checkbox is checked Angular 2
I have a checkbox group with 3 items. I created it with Angular 5.0.5 and Clarity vm. I want my function to check if at least one of the checkboxes is checked and THEN go at the next page, which is a ...
4
votes
2answers
2k views
Angular 4: reactive form control is stuck in pending state with a custom async validator
I am building an Angular 4 app that requires the BriteVerify email validation on form fields in several components. I am trying to implement this validation as a custom async validator that I can use ...
5
votes
1answer
3k views
Angular 2 : Validate child component form fields from the parent component
Problem statement :
Parent component having <form> tag and some <input> tags inside it, and child component also have some <input> tags, parent component has one <submit> and ...
0
votes
1answer
394 views
ng-maxlength not working
I have an Angular 4 Application. I am trying to add validation to form inputs, where inputs with numbers should not accept more than 4 digits. If more, it should invalid the form. I am using reactive ...
1
vote
1answer
256 views
Run validation on input based on change of checkbox in Angular 4
I am looping through an array of key values to create a list of checkboxes each with a sibling disabled input. On check of each checkbox, the sibling input text field becomes enabled and is required. ...
0
votes
1answer
77 views
How to restrict specail character Grave accent (backtick) in text box using angular js
i wants to validate text box which allows special character like []^_,atoz,1 to 10 characters.am using ng-pattern="/^[a-zA-Z0-9]*$/" it allows to enter but it doesnot enable submit button.But the ...
1
vote
0answers
126 views
Angular2 Form Validation not works on Safari
I'm using angular2-seed, with form validation. My project works well, but not on safari. When I go to the page has form validation, I get this error: EXCEPTION: Uncaught (in promise): ReferenceError: ...
1
vote
1answer
57 views
Angular js validations for a form in ng-repeat is not working as expected
I have a table, in which I have repeated the <tr> tag by using ng-repeat="cancellationPercentData in cancellationPercent"
Inside this tr tag I have a form with name and id set by using $index
...
0
votes
2answers
645 views
Set timeout to Angular Reactive From Validation message ngIF
Hi I'm using Angular (4) and i have a custom validator and display it via an ngIF
inValid(fieldName: string) {
return (
this.form.get(fieldName).hasError('pattern') &&
this.form....
1
vote
1answer
333 views
AngularJS form validation failing when input populated dynamic
I have the following form:
If I click on a star, the input will be automatically populated with the number of the clicked star. (clicking on the 3rd star the input will be populated with number '3' ...
2
votes
1answer
5k views
FormControl boolean without default value in angular 2
I'm using reactive forms in angular 2 (4.1.2)
I have a boolean property which I don't want to have a default value but it should be required.
This is how I create my form:
constructor(private fb: ...
16
votes
7answers
21k views
Custom Validator on reactive form for password and confirm password matching getting undefined parameters into Angular 4
I'm trying to implement a custom validator to check if the password and password confirm are equal. The problem is that the validator is getting undefined password and confirmedPassword parameters. ...
0
votes
0answers
345 views
How to validate the form using if condition with multiple errors in Angularjs?
I have a scenario,I have to validate the form on click of submit button,but I have a function with multiple error messages in a function using if condition.I have to display the respective error ...
0
votes
1answer
43 views
Validate set of radio buttons using AngularJS
my code looks like this:
<ng-form name="form">
<div>
Question 1
<label>
<input type="radio" ng-model="q1" style="visibility: initial; position: ...
2
votes
0answers
710 views
ng-required not working properly on select the value from dropdown
I have Date of birth drop down field,from that i selected the month,date and year values from dropdown.After selecting them as the error message showing previously it worked fine.
my code for that:
...
2
votes
1answer
75 views
How to Enable/Disable html controls' validation in AngularJS
I have a radio button group. First one for "Inside Bangladesh" and Second one for "Outside Bangladesh". If i click "Inside Bangladesh" no validation required for Address field(textbox), but If i click ...
0
votes
2answers
81 views
Clearing Form Validation Error on Typing
Edit (May, 4 2017):
After a lot of research, it's clear to me that this is not currently possible in a "native" way. See here: https://github.com/angular/angular/issues/7113
Original Post:
...
0
votes
1answer
107 views
Show custom validation on form load(AngularJs 1.6)
I have a custom validation like this:
app.directive('checkRfc', function() {
return {
require: 'ngModel',
link: function(scope, element, attr, mCtrl) {
function checkRfcValidation(...
0
votes
1answer
2k views
Angular 2: Length validation not working
I am trying to simply replicate the walkthrough from the Angular website but cannot get length validation to work:
<input
style="display:inline-block;min-width:150px"
class="form-input"
...
0
votes
1answer
170 views
ng-invalid ng-invalid-required showing error message
i am using form,have the row called DOB,user has to select the month,date and year,But the problem is even i select the date and year also showing the error message .
when i start debugging noticed ...
0
votes
0answers
74 views
Translating JQuery validator messages with nggetext
I'm using angularJS and I want to translate the require messages that JQuery validate has. For translations I'm using grunt nggettext, which works perfectly. The problem is that is not filtering the ...
0
votes
2answers
769 views
Angularjs ng-disabled
I have two inputs for validating email and password. I can see individuals of the following works:
myForm.$error.required
validating input form with required input value
and
myForm.email.$valid
...
8
votes
6answers
2k views
How to use the Angular jQuery Validate's checkForm() function
EDIT:
I've added a JsFiddle so you can easily troubleshoot instead of having to set up the environment yourself. As you can see, validation is done on the Email field even before the blur event on ...
-1
votes
2answers
429 views
Triggering form validation programmatically in angular-js
I am using a custom directive to submit a form programmatically however no form validation is applied before submitting the form. I have called $setDirty() on the form field and $setSubmitted() on the ...
0
votes
1answer
212 views
How to apply class level validation rules using the Angular implementation of jQuery Validate
I have used jQuery Validate's handy addClassRules function to apply a rule to all elements of a given class rather than relying on the elements' name attribute values. In using the Angular wrapper of ...
1
vote
2answers
96 views
How to make angular.js validation work inside a <form> tag
I wrote this code but it doesn't work when I place my app inside of <form name="myForm">... tag. What should I do to make it works! (whenever I place myForm inside of ng-app it works, but my app ...