title: Adding custom jQuery validation in SugarCRM editview
body: <p>I am trying to add custom jQuery script in either header or footer of Accounts edit view, searched everywhere in Google but can't find an hook that prints scripts in header or footer.</p>
  
  <p>My goal is to add custom validation for my custom fields, but as soon as I add jQuery code the page gets halted. </p>
  
  <p>I am inserting following code in <code>custom/modules/Accounts/metadata/editviewdefs.php</code></p>
  
  <pre><code>$viewdefs ['Accounts'] = array(
      'EditView' =&gt; array(
          'templateMeta' =&gt; array(
              'javascript' =&gt; '&lt;script type="text/javascript"&gt;
              $(document).ready(function(){
                  alert("This is my custom javascript code");
              });
              &lt;/script&gt;',
  </code></pre>
  
  <p>Above code produces below screen.</p>
  
  <p><a href="https://i.stack.imgur.com/kIqxI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kIqxI.png" alt="Screen after inserting jQuery"></a></p>
  
  <p>I remove the jQuery part like this</p>
  
  <pre><code>$viewdefs ['Accounts'] = array(
      'EditView' =&gt; array(
          'templateMeta' =&gt; array(
              'javascript' =&gt; '&lt;script type="text/javascript"&gt;
  
                  alert("This is my custom javascript code");
  
              &lt;/script&gt;',
  </code></pre>
  
  <p>I see following alert
  <a href="https://i.stack.imgur.com/2R1I2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2R1I2.png" alt="Simple javascript works fine"></a></p>
  
  <p>I see that the simple JavaScript code is working fine but problem occurs only when I add jQuery code, I tried adding jQuery library before above code but that did not solve the problem. </p>
  
  <p>Can someone tell what I am missing here?</p>