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

learn more… | top users | synonyms

0
votes
1answer
20 views

ng-show is not working for one of the similar input fields

I have a multistep form. I have ng-show which depends whether or not the input[type="text"] is empty. Now, it works for one section of the form, but doesn't work for another section of the form. <...
0
votes
1answer
15 views

Custom validation implementation for Check box rendering in table format

I have a requirement in which I have to display check box in a row (Tabular way of displaying). I could not use the default checkbox implementation which Ionic provides due to some issue while ...
0
votes
0answers
28 views

Checkbox valiadtion using Angular Js

I am using Angular js, in which i have a textbox and collection of checkbox. I want to check if atleast one checkbox is checked when the submit button is clicked. Below is the existing code: <form ...
0
votes
1answer
19 views

Validate controls within ng-repeat: textbox and textarea

I am using Angular js, in which i have a textbox outside and an ng-repeat containing textbox and textarea. I want to check if the fields contain value when submit button is clicked. I am able to ...
1
vote
1answer
32 views

Validation using AngularJs on button click event

I have a AngularJs form which contains textbox,textarea,dropdown,checkbox, date, time controls, ng-repeat textbox and textarea controls. I want to validate these controls only on submit button click ...
0
votes
2answers
19 views

How to use ng-required with $touched?

I try to set an input as required if another input has changed. My need is to require confirm password if password has changed. I use this on the input of confirm password but it is never required : ...
1
vote
2answers
42 views

“Required” validation doesn't work in <select> with default value

I have a required <select> field: <select name="service_id" class="Sitedropdown" style="width: 220px;" ng-model="ServiceID" ng-options="service.ServiceID as service....
0
votes
1answer
24 views

Angular Form Validation using Ng Model

Question: How can I show the validation error using only the ng-model if I cannot name the form and its elements. I have a html form to collect credit card details. To prevent the credit card data ...
0
votes
1answer
59 views

Angular directive change ngmodel value from null to undefined breaks validation

I have created a plnkr to describe my problem: Link to plnkr Problem description: I have a number field, the value from which is written to the model. First I implemented this feature like the first ...
0
votes
0answers
31 views

Character counter on CKEditor with AngularJS

I have implemented CKEditor with AngularJS using https://github.com/esvit/ng-ckeditor in my project. But now, I have to add character counter on it. I have used wordcount plugin for that. I'm ...
0
votes
0answers
16 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
21 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 ...
1
vote
1answer
270 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"...
0
votes
2answers
74 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. ...
1
vote
2answers
52 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 ...
1
vote
2answers
44 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
38 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
212 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....
3
votes
1answer
119 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 (...
3
votes
0answers
72 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 ...
4
votes
1answer
33 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
23 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"> ...
0
votes
1answer
45 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 ...
1
vote
0answers
27 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 ...
1
vote
1answer
92 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 ...
0
votes
3answers
114 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
206 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) ...
1
vote
1answer
80 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 ...
0
votes
1answer
275 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
73 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-...
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
100 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
22 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
99 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) { ...
0
votes
1answer
785 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
57 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
230 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
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 ...
3
votes
1answer
409 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 ...
0
votes
0answers
35 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
40 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?
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
51 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 ...
2
votes
2answers
548 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
83 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
485 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
343 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....
1
vote
4answers
657 views

Text Input allow only Integer input in angularjs

I want to set the html input[number] <input type="number" /> to allow only integer input (not float). Basically, the html input[number] allow '.' to be entered for float input and I don't want ...
2
votes
1answer
491 views

Validation on fields using index position

I have a couple of fields that I would like to replicate dynamically. I'm using ng-reapt which is doing the job. However, the validation messages are not working. Here's what I've got: <html ng-...