Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Apex getting Item values using JavaScript from the Printer-Friendly Template

boketiFeb 24 2014 — edited Feb 25 2014

Hi There

I have a problem getting the value of a Page 0 Item using JavaScript within the Printer-Friendly Template (footer).

May I explain what I'm doing.

I've developed a solution to disable the IR Action Menu and/or the Download Menu button for specific users dependent on values held in a database table. I did this via a Dynamic Action (DA) on Page 0

DA  Page_Load on Page 0

Seq 10 Execute PL/SQL Code

BEGIN

   select nvl(a.download_reports_ind,'N'),

          nvl(a.hide_ir_actions_menu_ind,'Y')

   into :P0_DOWNLOAD_REPORTS_IND,

        :P0_HIDE_IR_ACTIONS_MENU_IND

   from wms.users a

   where a.shortcut_name = v('app_user');

EXCEPTION WHEN OTHERS

          THEN NULL;

END;

Seq 20 Execute JavaScript Code

if (document.getElementById('P0_HIDE_IR_ACTIONS_MENU_IND').value == "Y") {

$('#apexir_ACTIONSMENUROOT').remove()

}

if (document.getElementById('P0_DOWNLOAD_REPORTS_IND').value == "N") {

$('.dhtmlSubMenuN[title="Download"]').remove();

}

--- End of DA ---

The Above works very well but doesn't work when using our 'Printer-Friendly' page template.

We have a 'Navigation Bar Entry' called 'Printer-Friendly' which when clicked on by the user re-renders the currently displayed page using the printer-friendly template (by setting the target as &APP_PAGE_ID.)

This too works very well

However I had to put the following JavaScript Code in the footer section of the Printer-Friendly Template

<script type="text/javascript">

if ($x(''P0_HIDE_IR_ACTIONS_MENU_IND'').value == "Y") {

$('#apexir_ACTIONSMENUROOT').remove();

}

if ($x(''P0_DOWNLOAD_REPORTS_IND'').value == "N") {

$('.dhtmlSubMenuN[title="Download"]').remove();

}

</script>

Nothing happens ......

If I remove the if condition from the JavaScript code and run

<script type="text/javascript">

$('#apexir_ACTIONSMENUROOT').remove();

</script>

The actions menu disappears if the 'Printer-Friendly' template is invoked, so clearly the problem appears to be getting the values of Page 0 items using JavaScript on the Printer-Friendly Template.

We're using Apex 4.2 EPG against a 11.2 Database.

Many Thanks in Advance.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 25 2014
Added on Feb 24 2014
5 comments
3,034 views