title: How to validate a form field inside the validation of different form with JS
body: <p>How to validate a form field inside the validation of different form 
  As I have two forms if am i am submitting first form without feeling another form then how can i validate another form in JS. 
  Please help me</p>
  
  <p>my code is as below</p>
  
  <pre><code>&lt;form action="#" method="post" target="_top" onsubmit="return validate()" id="sponsorform1"&gt;      
      &lt;input style="margin-left: 25px;" type="image" alt="" name="submit"
        src="http://www.voyage.com/wp-content/uploads/2014/02/sponsor.png" width="250px"&gt;&lt;br&gt;
      &lt;input type="hidden" name="cmd" value="_xclick"&gt;&lt;br&gt;
      &lt;input type="hidden" name="business" value=""&gt;&lt;br&gt;
      &lt;input type="hidden" name="no_shipping" value="1"&gt;&lt;br&gt;
      &lt;input type="hidden" name="currency_code" value="GBP"&gt;&lt;br&gt;
      &lt;input type="hidden" name="no_note" value="1"&gt;&lt;br&gt;
      &lt;input type="hidden" name="rm" value="2"&gt;&lt;br&gt;
      &lt;input type="hidden" name="amount" value="300"&gt;&lt;br&gt;
      &lt;input type="hidden" name="item_name" value=""&gt;&lt;br&gt;
      &lt;input type="hidden" name="custom" value=""&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>my second form is:</p>
  
  <pre><code>&lt;form action="#" method="post" target="_top" onsubmit="return validate()"
   id="ninja_forms_form_2"&gt;      
    &lt;input style="margin-left: 25px;" type="image" alt="" name="submit"
     src="http://www.voyage.com/wp-content/uploads/2014/02/sponsor.png" width="250px"&gt;&lt;br&gt;
    &lt;input type="text" name="name" &gt;&lt;br&gt;
    &lt;input type="text" name="surname" &gt;&lt;br&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>if i am submitting my first form onclick of image then i must validate my second form.
  how can i do this in Javascript???
   please help me....</p>
  
  <p>My Javascript for validation is</p>
  
  <pre><code>&lt;script  type="text/javascript"&gt;
      function validate() {
        alert('hi');
        if (!document.getElementById("ninja_forms_form_2").submit()) {
          alert('Please Fill up the Below Form');
          var x=callme();
          return false;
        }
      }       
  
      function callme() {
        alert('call');    
       }
  &lt;/script&gt;
  </code></pre>
  
  <p>As its not showing this alert 'call'<br>
  please help as am very new to this .</p>