title: 2 functions in the same button during submitting the form
body: <p>I want to submit a form , the story that what i want exactly is when i click on the button submit&quot; if there was an error(fields not filled) , show me message and go to a specific <strong>&quot;id&quot;</strong> section in the body  otherwise it will jump automatically to new <strong>section tag</strong>,</p>
  <p>I have applied that on a the button submit like that :</p>
  <pre><code>  &lt;script&gt;
      function validate() {
      if (form.errors){
        return alert('{{ message }}');
        document.getElementById('firstsectionid').scrollIntoView();
      } 
      else{
        document.getElementById('nextsectionid').scrollIntoView();
  }
  
     &lt;/script&gt;
  </code></pre>
  <p><strong>code button submit:</strong></p>
  <pre><code>  &lt;button class=&quot;floated&quot; href='#nextsectionid' onclick=&quot;validate()&quot;&gt;Next&lt;/button&gt;
  </code></pre>
  <p>But it doesn't give any result , help please. thanks in advance.</p>