title: SugarCRM - Trigger Javascript function when relate field is populated
body: <p>I want to trigger some JavaScript when a relate field is populated</p>
  
  <p>I was hoping to find a way of Jquery monitoring the hidden field contact_id and when it changes calling the Javascript function but I'm not sure this is possible</p>
  
  <p>At the moment I changed editviewdefs so that the event triggers onblur</p>
  
  <pre><code>Code:
  
   array (
              'name' =&gt; 'contact_name',
              'label' =&gt; 'LBL_CONTACT_NAME',
              'customLabel' =&gt; '{$MOD.LBL_CONTACT_NAME}:  &lt;span class="required"&gt;*&lt;/span&gt;',
              'displayParams' =&gt; 
              array (
                'initial_filter' =&gt; '&amp;account_name_advanced={$fields.account_name.value}&amp;status_advanced=Live',
                'field' =&gt; 
                array (
                  'onchange' =&gt; 'getOpenCases()',
                ),
                'javascript' =&gt; 
                array (
                  'btn' =&gt; ' onblur="getOpenCases()" ',
                  'btn_clear' =&gt; ' onblur="getOpenCases()" ',
                ),
              ),
              'tabindex' =&gt; '11',
            ),
  </code></pre>
  
  <p>But this means the user has to click away from the field before the event is triggered</p>
  
  <p>I want it to happen as soon as contact_id is populated</p>
  
  <p>Is this possible? If so how do I achieve it?</p>