1

can we have two forms with the same form name on the same page ?

will angular validation work properly for each form ?

For example

<form name="ajax">
        <input type="text" name="fname" />
</form>
<form name="ajax"> 
        <input type="text" name="fname" />
</form>
jothi
  • 11
  • 3

1 Answers1

0

As per my understanding angular validation is not working properly with same form name in same page.

Angular will only consider the last form name

Ex:

<form name="myForm">
<input name="myInput" ng-model="myInput" required>
</form>

<form name="myForm">
<input type="email" name="myInpu" ng-model="myInpu">
</form>



<p>The input's valid state is:</p>
<h1>Form 1 : {{myForm.myInput.$valid}}</h1>
<h1>Form 2 : {{myForm.myInpu.$valid}}</h1>
CodeMan
  • 1,941
  • 6
  • 26
  • 44