title: Javascript validate form OR function
body: <p>I am trying to ask the user to input at least 1 of the options. From my codes the user need to input all the inputs. Can anyone please check what is wrong with my code?</p>
  
  <p><strong>jsp</strong></p>
  
  <pre><code>&lt;form role="form" method="POST" id="search" action="Servlet" 
        onsubmit="return validateForm();"&gt;
  
      &lt;label&gt;Name&lt;/label&gt; 
      &lt;input name="name"&gt;
  
      &lt;label&gt;ID&lt;/label&gt; 
      &lt;input name="id"&gt;
  
      &lt;label&gt;no&lt;/label&gt; 
      &lt;input name="no"&gt;
  
      &lt;button type="submit"&gt;Search&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>javascript</strong></p>
  
  <pre><code>function validateForm() {
      var name = document.forms["search"]["name"].value;
      var id = document.forms["search"]["id"].value;
      var no = document.forms["search"]["no"].value;
  
      if ( (name == null || name == "") || (id == null || id == "") || (no == null &amp;&amp; no == "")) {
          alert("Please enter either one to perform search");
          return false;
      }
  }
  </code></pre>