west007 west007 - 2 years ago 81
Javascript Question

Calling javascript from ADF page (jsff)

I have taskflow containing a .jsff page (Let's call this child page) in which we are calling javascript method on click of a button. The javascript methos is doing

element = findComponent("id")

and then doing some operation on that element. This javascript method is added to .jsff page as a resource.

This taskflow is inserted in another page (Let's call this page as parent page) as a region . Now the parent page also has an element with id ="id" which is being used in findComponent of child page, that is child page and parent page has the same id.

So does invoking of javascript from child page taskflow will find element of child page or parent page?

Sam Sam
Answer Source

You can use af:resource tag to add javascript function , but it would be better to add it to a page component so that the browser does not cache it

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
 <af:resource type="javascript">
    function yourMethod(evt){ ... }

You should read more about this.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download