1

Please think in angularjs way.

Actually my layout is different.

I have input fields inside form and also have input fields outside form, this is a special case in my product.

I know about form attribute in HTML5

But

In AngualrJS: I want to achieve outside form input fields works as good as inside form input field works for validation purpose.

Is it possible?
We can not remove the place of form tag.

If Yes please guide me.

<div ng-app="myApp" ng-controller="validateCtrl" >
  <h6>Validation Example</h6>

  <form id="frm" name="myForm" novalidate>
    Inside form 
    <p>
      <input type="submit" ng-disabled="myForm.email.$dirty && myForm.email.$invalid">
    </p>
  </form>

  Outside form
  <p>Email:<br>
  <input form="frm" type="email" name="email" ng-model="email" required>
  </p>

</div>

Plunker

3
  • You can set form to parent element as well as create several forms -- does not it solve problem? Commented Mar 19, 2019 at 17:07
  • No we can not do this things. Do you have any solution without doing this. Example is just a scenario. Commented Mar 20, 2019 at 10:46
  • Another thing is if your only problem is that you cant move form tag -- you always can add parent form (add ng-form to parent div ). Commented Mar 20, 2019 at 11:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.