AnsweredAssumed Answered

How can I add javascript to convert lead page?

Question asked by Asaf Army on Mar 26, 2014
Latest reply on May 21, 2014 by Harald Kuske
i add a javascript code, to editviews, by adding "includes" in the templatemeta array in the editviewdefs.php of the modules. for example: in contacts i add a file "Contacts.js" to custom/modules/Contacts folder and add this include in the editview:

'includes' =>       array (
        0 => 
        array (
          'file' => 'custom/modules/Contacts/Contacts.js',
        ),
      ),

then i just call the js function from the textbox:

0 =>           array (
            'name' => 'test_dropdown',
            'label' => 'LBL_TEST_DROPDOWN',
           'displayParams' => 
         array  (
            'field' => 
            array  (
              'onChange' => 'updateOtherDropDown(this.value);',
              ),
           ),

          ),


this doesn't work in custom/modules/Leads/metadata/convertdefs.php although i put the includes in the right place:

$viewdefs['Contacts']['ConvertLead'] = array(    'copyData' => true,
    'required' => true,
    'select' => "report_to_name",
    'default_action' => 'create',
    'templateMeta' => array(
        'form'=>array(
            'hidden'=>array(
                '<input type="hidden" name="opportunity_id" value="{$smarty.request.opportunity_id}">',
       '<input type="hidden" name="case_id" value="{$smarty.request.case_id}">',
       '<input type="hidden" name="bug_id" value="{$smarty.request.bug_id}">',
       '<input type="hidden" name="email_id" value="{$smarty.request.email_id}">',
       '<input type="hidden" name="inbound_email_id" value="{$smarty.request.inbound_email_id}">'
            )
        ),
  'maxColumns' => '2', 
        'widths' => array(
            array('label' => '10', 'field' => '30'), 
            array('label' => '10', 'field' => '30'),
        ),
       
        'includes' => 
       array (
         0 => 
         array (
           'file' => 'custom/modules/Leads/Leads.js',
         ),
       ),

the leads.js is not included in the convert lead page.
anyone?

Outcomes