Angularjs validation patterns, syntax and properties. Validation of forms, controls, models using various angular validation directives.

learn more… | top users | synonyms

0
votes
0answers
15 views

has-class not getting applied through ng-repeat form validation : angularjs

<div class="col-md-12" data-ng-repeat="p in ['A1','A2','A3']"> <div class="form-group col-md-6" data-ng-class='{ "has-focus": form.model[p].hasFocus, "has-success": form....
0
votes
1answer
19 views

$error.required message is not getting reset on reset button : AngularJs

<div class="form-group"> <input type="text" name="Name" data-ng-model="panNumber" required> <p data-ng-show="loginForm.Name.$error.required && (loginForm.Name.$touched ...
0
votes
3answers
641 views

How to set the validation on blur event?

I have wrriten some sample in plunker. I need to validate my input when the user leaves it. I used ng-model-options="{ updateon: 'blur'}" for this. ng-minlength works fine but this doesn't apply to ...
1
vote
1answer
53 views

Date validation in AngularJS

I cannot allow future date in my form built in angularjs Here is my HTML: <div ngCloak ng-app="laurelMoney" ng-controller="myCtrl"> <form name="userForm"> <div class="form-group"...
1
vote
2answers
23 views

Angular: force custom form validator to run on any field input

I've written a custom validator for a password field, in order to verify the following scenarios: if user has id defined, then password is always valid (can be empty, meaning no change) if user does ...
0
votes
2answers
35 views

Cannot read property '$valid' of undefined if form is inside a div with ng-if condition

I have a form inside a div with ng-if condition. Initially form is closed. On click a button, form is displayed. But on submitting form, I'm getting Cannot read property '$valid' of undefined error. ...
18
votes
5answers
31k views

angularjs ng-minlength validation is not working, form still being submitted

I am trying to submit the form on only successful validation. validation is working for required but not working for ng-minlength form input is invalid but form is still being submitted. <form ...
1
vote
2answers
30 views

angularjs form validation that has an internal form

I have a form by some input. and some time I have another form by some input into this form. when I have not internal form, my parent form is valid, but when I have internal in original form and ...
0
votes
1answer
23 views

Angular JS Validation - How to turn off required for a single field

I'm trying to turn off the required attribute for a single input field in an Angular form on submit, if a certain condition is not met. I have tried the following: form.ChangeCreditCard.$setValidity("...
2
votes
1answer
99 views

Angular Form Validation: $error.required set even when ng-required=false with custom input directive

I have Custom input component with validation with ngMessages,FormController and ng-required: <div class="col-sm-9 col-xs-12"> <input id="{{$ctrl.fieldName}}" name="{{$ctrl....
2
votes
1answer
68 views

AngularJS form validation ngMessages not working with multi-step form

I am using AngularJS 1.5, ui-router for state management and ngMessages for validation and ngMaterial for UI. I have one main view contained in myformView.html and I load inside it two states (...
2
votes
0answers
44 views

Validate dynamically created Check box and Radio buttons

I have an application in which dynamically check boxes and radio buttons get generated based on the data sent from the server. The number of check box/radio button displayed can increase up to 20 (in ...
3
votes
1answer
253 views

Hide error labels shown with angularjs form validation after some time

I am using angularjs form validation for client side validation. I need to hide the labels which displaying with angularjs error form validation method, after 3 seconds, after message appear. Html ...
4
votes
1answer
32 views

validate certain fields of a form depending upon type of user loged in

i have a form which contain 10 fields, if user type 1 is loged in only one field should be validated else all the fields should be validated.is it possible to validate certain fields depending upon ...
0
votes
1answer
18 views

Input validation: Validation message and ng-disabled buttons not working as expected

I have the following code which I'm trying to validate using AngularJS: <div ng-form="transWizard" novalidate> <div style="word-wrap:break-word; padding-top:4px; padding-left:14px"> ...
1
vote
4answers
916 views

Angularjs validation - bootstrap datepicker input is not recognized

If you read following Angularjs validations, you understand that: Message will appear if user interacted and did not fill the date manually. The problem is when date is filled using the datepicker the ...
0
votes
1answer
25 views

Invalidate form if disabled select option is chosen

Is there a way to invalidate a form if value="0" in my select tag is chosen? The reason I did this is to have a default select option show up before a user see's anything. But even if a user doesn't ...
6
votes
5answers
10k views

Validation on text on alphabets enter

Any one use AngulerJS Validation on TextBox. So that only enter alphabets.
1
vote
0answers
24 views

ng-pattern not allowing the invalid data inside the input field

I am using a ng-pattern to validate input field string. I am facing a issue if incorrect string is not populating inside the input field. I have tried using putting this validation inside the ...
0
votes
1answer
70 views

Angular validator, pass data along with error code to be displayed in ngMessages

Is that possible to store some additional data along with the error flag itself, using standard Angular mechanism? i.e. I'm manually setting ngModel.$setValidity, I'd like to pass some data along ...
1
vote
1answer
59 views

How to enable AngularJS validation for button that is outside of form?

I am new to angular, I was struck to trigger a form validation with the button outside the form. I have two buttons one inside form, which works and one outside, I want the outside button to do the ...
1
vote
1answer
65 views

Issue in JQuery Validation with AngularJS

I use ruby on rails and Angular. I follow - https://github.com/jpkleemans/angular-validate I do following APPLICATION.JS //= require jquery //= require app/jquery.validate.min.js //= require ...
4
votes
5answers
31k views

Validate phone number using angular js

Want to set phone-number to 10 digits, How can I do this using angular js. This is what i have tried: <form class="form-horizontal" role="form" method="post" name="registration" novalidate> &...
0
votes
3answers
58 views

How to manually change the $error values for input tags - Angularjs

I am submitting a form via the angular $http and I want to give an error if the user bypassed the angularjs validation. I want to use the same error tag as if they didn't bypass the validation, ...
1
vote
2answers
78 views

AngularJS form input name validation not working in ngrepeat

name="number-{{$index+1}}" working in ng-repeat at the same time myform.number-{{$index+1}}.$invalid does not working for the form Demo: http://plnkr.co/edit/Z3EmpHu8w2iZcZko9dJv?p=preview var ...
0
votes
0answers
14 views

Angular: require vaildation triggered even if there is no require attribute

I created a custom form control which requires ngmodel and overrides required validator with the following code: ngModelCtrl.$validators.required = function (modelValue) { if (!modelValue) ...
44
votes
1answer
83k views

AngularJS Dropdown required validation

Following is my code snippet. I want to validate my dropdown using angular. <td align="left" width="52%"> <span class="requiredSmall">*</span> <select class="...
2
votes
1answer
1k views

kendo ui, angular require validation for numeric text box

I am trying to use a kendo numeric text box with angular validation (ng-required) however I'm not able to get it working. The ng-required attribute on this element has no effect on the form validation ...
0
votes
1answer
195 views

angularjs single input filed for both email and mobile number

In the registration form i have single field for both email and mobile number but it doesn't working properly. <form name="regForm" > <md-input-container flex md-no-float> <input ng-...
-1
votes
1answer
59 views

How to perform dropdown control validation with angular js validator?

I am doing angular js dropdown validation but getting problem when doing dropdown validation. I have taken everything from this website and using this code: https://github.com/turinggroup/angular-...
2
votes
3answers
924 views

AngularJS Validation framework

Is it feasible and not particularly arduous to create a validation framework that could be used in the following manner: var myValidations = [ { 'A', 'This is required', function(...
0
votes
0answers
37 views

What is the best practice for wrapping custom angular form controls?

In our app we have an autocomplete form control that is fairly customizable but I don't want to duplicate the same markup and logic throughout our app for common uses (searching for users/groups). I ...
0
votes
0answers
82 views

uib-accordion validate radio buttons

the following code does disable button until radio buttons are checked in all the panels, but I want to validate the one only in the panel that is open. Please let me know what should be done. <...
0
votes
0answers
19 views

angularjs ngModelController.$validators for custom validation $name property does not gets populated

On a custom directive inside postLink function I have , ngModelController.$validators.min = function(modelValue, viewValue) {... } Now when I need to check if min validation is falling then I am ...
0
votes
2answers
60 views

Pass custom parametrs to $asyncValidators

I have directive which is an async validator: // part of directive return { restrict: 'A', scope: { edit: '=', }, require: 'ngModel', link: function(scope, element, attrs, ngModel) { ...
1
vote
0answers
265 views

FCSA number does not validate a negative number if assigned by the controller

I'm working with FCSA number If I enter a negative number in the input, the validation works correctly but if I value the variable ng-model from the controller, the validation is not working. Why? ...
2
votes
3answers
2k views

adding ng-invalid class on input mismatch

Angular adds ng-invalid class automatically to email input field if it's invalid, how's it possible to have the class ng-invalid added to input#confirmEmail if it's doesn't match to input#email and ...
0
votes
1answer
555 views

AngularJS validation using ng-messages without a form control

I store time as an integer of minutes in the database/model. However, I want to display it to the user in decimal hours (and let them edit the value using a number of buttons). At the moment I have ...
0
votes
1answer
48 views

angularjs - evaluate Expression inside validator directive

I have a custom validation attribute directive that can get expressions, for example: <input type="text" uiSelectRequired="isParam == true"/> how do I evaluate this expression in my directive ...
1
vote
2answers
158 views

Required field Validation on input on image button click

The validation works correctly when I have it on the button with type submit. However, I have an image that acts like an image button for me and I want the project name to be filled before the user ...
0
votes
2answers
570 views

Why does adding additional AngularJS validation directives cause $asyncValidators to run multiple times?

Why does adding additional AngularJS validation directives cause $asyncValidators to run multiple times on page load? I created a custom directive which implements $asyncValidators. This is the ...
0
votes
0answers
24 views

AngularJs Validation on indexed fields

I have to apply validation on a drop down list which has name as indexed variable. <select name="data[$index+1]" ng-model="data[$index+1]" required> and error message is like this: <span ...
0
votes
0answers
34 views

How to Manually set field as Invalid in Jcs autovalidation in angularjs?

Here Demo Hi All, I am using jcs validation in my project.Am doing some business level validation.so what I exactly need is I want to Manually set field as invalid based on condition inside ...
0
votes
1answer
36 views

how to validate form in email in AngularJS ?

I'm sending email using NodeJS with html/angularjs template. There is a form, i'm sending in email. AngularJS validations are not working in email. How would I do validation?
2
votes
2answers
394 views

Angular - Requiring ngModel and using it in controller of custom directive, not link function

Can anybody tell me if it's possible to require and use ngModel inside the controller of a custom Angular directive. I'm trying to stay away from the link function. I see most examples use the link ...
0
votes
0answers
35 views

custom validation in angularjs forms

While working with forms in Angularjs I need to add the validation rules based on some conditions. Lets say based on a ng-model value of one attribute I need to decide if the text box is mandatory or ...
0
votes
0answers
42 views

Validating form in Angularjs with optional conditions

I have a select box in which I have two options Enable and Disable. There are two datepicker objects, one for enable time and another for disable. If I select the Enable from the dropdown, Enable ...
0
votes
0answers
70 views

angularjs form validation for file input

I am using Angularjs form validation. I have a textfield and file upload filed. Currently I have handled the validation for either one of them should be present. But there are few additional rules ...
1
vote
1answer
366 views

AngularJS form remains $dirty setting every input $pristine manually

I have a HTML form[name="mainForm"] with many inputs. When I modify an input the $scope.mainForm.$dirty becomes true (and that's right) but when I setPristine() a field I have previously modified ($...
0
votes
1answer
206 views

AngularJS trigger field validation after form loads

I have set of data fields. They look like this: // Read-Only <div class="field-group" ng-if="feature.edit == false"> <div class="label" ng-class="{'feature-required': field.Validations....