Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call Javascript function on AMX page load?

I'm trying to call a Javascript function on page load using invoke action in AMX page but its throwing exception. I'm using following code. My js file contains 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 invoke action method I'm calling js function in the following code:

AdfmfContainerUtilities.invokeContainerJavaScriptFunction(AdfmfJavaUtilities.getFeatureName(), "DayView.gotoFirstOperation", new Object[]{});

I'm getting 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?

like image 311
udaykiran.nalla Avatar asked May 29 '26 17:05

udaykiran.nalla


1 Answers

Try to add that code inside amx:facet of amx page: And remember to include your js file to maf-feature.xml content list.

 <amx:verbatim id="v1">
<![CDATA[
        <script type="text/javascript">
            document.onload = myMethod();
        </script>
    ]]>
</amx:verbatim>
like image 146
Magnus Avatar answered Jun 01 '26 06:06

Magnus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!