Why are Portlet Javascript Functions Not Being Renamed/Prefixed Correctly when Portlet is Placed on a Page? (Doc ID 1504687.1)

Last updated on MARCH 08, 2017

Applies to:

Oracle WebCenter Portal - Version 11.1.1.4.0 and later
Information in this document applies to any platform.

Symptoms

The Javascripts in the Webcenter Page (VIEW SOURCE) do not get renamed consistently and results in broken functionality.
Some javascripts gets renamed and some do not.

For example, the  JSP based portlets have javascript function names as:
function changeDropdown(field)
function parseResponse(responseXML)
function addToList(selectElement, text, value)
function clearList()

However when the portlet is rendered in the browser, the function names are renamed to
function changeDropdown(field)
function adfp821339505_parseResponse(responseXML)
function adfp821339505_addToList(selectElement, text, value)
function adfp821339505_clearList()

The only function that keeps the same name as source code is changeDropdown,

The following sample test case demostrates the problem from JDeveloper:

1. Create a Portlet Producer with a  Portlet  containing the following code and deploy the application to a managed server:

 <script type="text/javascript">

 function changeDropdown1(field) {
     var selIndex = field.selectedIndex;
     var selectedValue = field.options[selIndex].value;
     myParam('value1', selectedValue, function()
        getStateList("ggg")
     });
 }

 function getStateList(str) {
     var a = "qqq";
 }

 function myParam(param1, param2, callback) { 
      callback();  
 }  

 </script>

 <input type="button"  value="Show alert box" />

  <select onchange="changeDropdown1(this)">
        <option value="USA">USA</option>
        <option value="Canada">Canada</option>
        </select>

         

2. Create a Webcenter Portal FrameWork application.
3. Register the Portlet producer
4. Drop the Portlet on a Page
5. Run the Page
6. View Source. Notice:


function changeDropdown1(field) {
    var selIndex = field.selectedIndex;
    var selectedValue = field.options[selIndex].value;
    myParam('value1', selectedValue, function() {  
       getStateList("ggg")
    });
}

function adfp1882801302_getStateList(str) {
   var a = "qqq";
}

function adfp1882801302_myParam(param1, param2, callback) {  
     callback();  
}  

</script>

<input type="button" value="Show alert box">

 <select onchange="changeDropdown1(this)">
       <option value="USA">USA</option>
       <option value="Canada">Canada</option>

  </select>

 

 



This causes the Portlet not to run/behave correctly.

The issue happens only when the portlet contains Javascript  with callback functions.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms