AnsweredAssumed Answered

Calling Javascript function from a relate field in Editview

Question asked by Asaf Army on Aug 18, 2016
Latest reply on Aug 28, 2017 by Bao Tran Hoang

Hello developers!

 

I need to call a javascript function when a record is chosen in a relate field (in the editview).

i know how to do that with standard fields like dropdowns and others but the javascript function is not called on relate fields.

 

1. i added the include in custom/modules/aa_Subscriptions/metadata/editviewdefs.php

 

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

 

2. added the "onchange" event in the field:

 

0 => 

array (

   'name' => 'aos_products_aa_subscriptions_2_name',

   'displayParams' => 

      array (

         'field' => 

            array (

               'onChange' => 'doSomthing(this.value);',

            ),

      ),

),

 

3. added a javascript file  custom/modules/aa_Subscriptions/Subscription.js

 

function doSomthing(param)
{
   alert('write your code here');

}

 

any way for that to work?

i really really need to find a solution for this. any help will do...

Outcomes