title: With Angularjs is there a way to submit only sections of a form in the javascript?
body: <blockquote>
    <p><em>version: Angular 1.4</em></p>
  </blockquote>
  
  <p>I have a form with fieldsets that represent different sections I want the user to fill out. These sections can be navigated through using next and previous buttons. I want to place some limitations, these being only when the user has completed a section with valid input can they move on to the next section.</p>
  
  <p>This is perfectly illustrated in this question and answer:
  <a href="https://stackoverflow.com/questions/15732184/angular-js-validate-form-fields-before-submit">Angular JS: Validate form fields before submit</a></p>
  
  <p>However I am looking for a slightly different solution. I intend to have the logic that controls the next button in my javascript.</p>
  
  <p>Is there any way to access these ng-form properties from my javascript? I have tried the same way that form is accessible via it's name property but despite this I get an error saying this variable is unavailable.</p>
  
  <p>I basicly want to check the fieldset for validity when the user hits next and if the form is invalid have the appropriate errors show on the section without submitting the form.</p>
  
  <p>I have checked the documentation for forms at Anuglars website with no luck.</p>
  
  <p>Any help is appreciated.</p>
  
  <p>Edit:
  So I found the documentation for sub forms ng-form:
  <a href="https://docs.angularjs.org/api/ng/directive/ngForm" rel="nofollow noreferrer">https://docs.angularjs.org/api/ng/directive/ngForm</a></p>
  
  <p>The document states that when I use this directive it will be published to the scope with the same name however in my js when I try to access it it is unavailable. eg:</p>
  
  <pre><code>&lt;form name="form"&gt;
      &lt;fieldset ng-form="step1form"&gt;&lt;/fieldset&gt;
      &lt;fieldset ng-form="step2form"&gt;&lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>And in the js within the controller obviously:</p>
  
  <pre><code>console.log(form);
  // &lt;form name="form"&gt;...&lt;/form&gt;
  
  console.log(step1form);
  // ReferenceError: step1form is not defined
  </code></pre>