Add onClick="myFunction()" on radio button

Hi Everyone!
I need to figure out how to insert onClick=“myFunction()” to my radio button.

I’ve created a Custom Module and I’ve insert a radio button field with different value.
Now, I need to call a js when uno if this is checked.

My javascript is correclty load in the page, and it works if I call my function by pressing button that I’ve insered in html field.

I would that the function was callback when I check on of my radio button.

I suppose that I have to add some code to my array field, I follow different topic but without success.

This is my array

valore_dispositivo' => 
    array (
      'required' => true,
      'name' => 'valore_dispositivo',
      'vname' => 'LBL_VALORE_DISPOSITIVO',
      'type' => 'radioenum',
      'massupdate' => '1',
      'no_default' => false,
      'importable' => 'true',
      'duplicate_merge' => 'disabled',
      'duplicate_merge_dom_value' => '0',
      'audited' => true,
      'inline_edit' => true,
      'reportable' => true,
      'unified_search' => false,
      'merge_filter' => 'disabled',
      'len' => 100,
      'size' => '20',
      'options' => 'fasce_list',
      'studio' => 'visible',
      'dbType' => 'enum',
      'separator' => '<br>',

I try to add ‘display_params’ but doesn’t work

Someone can help me?

Thanks in advance

In your javascript file you can try something like:

$(document).ready(function() {
$("#valore_dispositivo").on("click", function() {
//Do something when clicked
1 Like