Oracle Apex set page item's value using JavaScript

Oracle Apex: Set Page Items Value Using JavaScript on the Click of a Link in Interactive Report

This Oracle Apex tutorial shows you how to set page items value using JavaScript on the click of a link in Interactive Report.

Follow these steps to perform this task:

1. Create a JavaScript Function.

Create a JavaScript function for the page having the interactive report. To add the function, click on the page then in the property palette, JavaScript > Function and Global Variable Declaration, add the following code:

function setItems(pempid, pdeptid)
{ 
    apex.item( "P7_EMPID" ).setValue (pempid);
    apex.item( "P7_DEPTID" ).setValue (pdeptid);
}

The above JavaScript function code will set the page items P7_EMPID and P7_DEPTID values using the apex.item().setValue() JavaScript APIs, to the values passed by the parameters. We will call the above JavaScript function on the click of a link in the interactive report.

2. Call the JavaScript Function on the Link Click of Interactive Report.

Now select the column in the interactive report from which you want to call the JavaScript function to set the values. Set the type of the column to Link and set the target type as URL and add the following code for the URL value:

javascript:setItems(#EMPLOYEE_ID#, #DEPARTMENT_ID#);

It is done. Save the changes and test the report.

See also:

This Post Has One Comment

  1. azam sajid

    im getting [object HTMLCollection] in the page item rather than my doc_num value

Comments are closed.