title: Uncaught ReferenceError: validate is not defined (jQuery validation)
body: <p>I am getting this error and the script never seems to work.</p>
  
  <blockquote>
    <p>Uncaught ReferenceError: validate is not defined </p>
  </blockquote>
  
  <p>I also tried to call the function onsubmit from the  and also tried to place the function inside the page and in a separate JS file but same results. 
  The html file:<code>show.gsp</code></p>
  
  <pre><code>&lt;body&gt;
  
  &lt;div class="row"&gt;
      &lt;div class="col-md-9 col-sm-9"&gt;
          &lt;g:form class="form-inline" role="form" action="update" name="form" &gt;
              &lt;div class="form-group has-feedback"&gt;
                  &lt;label class="control-label" for="mcc"&gt;GSM.Identity.MCC&lt;/label&gt;
                  &lt;br/&gt;
                  &lt;input type="text" class="form-control required" name="mcc" id="mcc" value="${mcc}"&gt;
                  &lt;span class="glyphicon form-control-feedback"&gt;&lt;/span&gt;
              &lt;/div&gt;
              &lt;br/&gt;
              &lt;br/&gt;
  
              &lt;div class="form-group has-feedback"&gt;
                  &lt;label class="control-label" for="mnc"&gt;GSM.Identity.MNC&lt;/label&gt;
                  &lt;br/&gt;
                  &lt;input type="text" class="form-control required" name="mnc" id="mnc" value="${mnc}"&gt;
                  &lt;span class="glyphicon form-control-feedback"&gt;&lt;/span&gt;
              &lt;/div&gt;
              &lt;br/&gt;
              &lt;br/&gt;
  
              &lt;div class="form-group has-feedback"&gt;
                  &lt;label class="control-label" for="co"&gt;GSM.Radio.CO&lt;/label&gt;
                  &lt;br/&gt;
                  &lt;input type="text" class="form-control required" name="co" id="co" value="${co}"&gt;
                  &lt;span class="glyphicon form-control-feedback"&gt;&lt;/span&gt;
              &lt;/div&gt;
              &lt;br/&gt;
              &lt;br/&gt;
              &lt;p&gt;
                  &lt;button type="submit" class="btn btn-success btn-sm" id="submit" onclick="validate()"&gt;Save Settings&lt;/button&gt;
                  &lt;g:link action="restart" class="btn btn-danger btn-sm"&gt;Restart OpenBts&lt;/g:link&gt;
              &lt;/p&gt;
          &lt;/g:form&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;script src="${resource(dir:'js', file:'main_script.js') }"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>and the script: <code>main_script.js</code></p>
  
  <pre><code>//validation script
  function validate(){
  
      console.log("test");
  
      var mcc = $("#mcc").val();
      var mnc = $("#mnc").val();
      var co = $("#co").val();
  
      if (!$.isNumeric(mcc)){
          $("#mcc").parent("div").removeClass("has-feedback has-error has-success").addClass("has-error");
      }
      if (!$.isNumeric(mnc)){
          $("#mnc").parent("div").removeClass("has-feedback has-error has-success").addClass("has-error");
      }
      if (!$.isNumeric(co)){
          $("#co").parent("div").removeClass("has-feedback has-error has-success").addClass("has-error");
      }
  }
  </code></pre>