How do I call a javascript function on AMX page load?
I am trying to call a java script function on page load using the invoke action on the AMX page, but this is an exception to throw. I am using the following code. My js file contains the following code
(function(){
if (!window.application) window.application = {};
DayView.gotoFirstOperation =function(){
var element =document.getElementById('box');
alert('Method exeuted');
if( 'null' != element){
element.scrollIntoView();
}
}; })();
My in invoke action method I am calling the js function in the following code.
AdfmfContainerUtilities.invokeContainerJavaScriptFunction(AdfmfJavaUtilities.getFeatureName(), "DayView.gotoFirstOperation", new Object[]{});
I am getting the following exception invokeContainerUtilitiesMethod 'invokeContainerJavaScriptFunction' encountered an error[ERROR[oracle.adfmf.framework.exception.AdfException]-JS Response returned a nil response.].
Is there any other way I can call the js function on AMX page load?
Try adding this code inside the amx: facet of amx page: And don't forget to include your js file in the maf-feature.xml content list.
<amx:verbatim id="v1">
<![CDATA[
<script type="text/javascript">
document.onload = myMethod();
</script>
]]>
</amx:verbatim>