In a form field of a custom component, I want to specify a javascript function for an onchange event like this:
<field
...
onchange="myCustomJavascriptFunction();"
/>
Where I should put my myCustomJavascriptFunction and how to specify it to Joomla so that it is executed on the change event?
EDIT
The usual way of declare it in the view doesn't work:
$document->addScript(JURI::root() . "/components/com_mycomponent"
. "/views/myview/myCustomJavascriptFunction.js");