0

In a page X I create the variable Userrole using:

APEX_UTIL.set_session_state(p_name => 'USERROLE', p_value => userRole);

In an other page, How can I use the value of this variable in a Javascript code?

O. Sam
  • 178
  • 1
  • 5
  • 17
  • https://stackoverflow.com/questions/5482030/how-to-access-oracle-apex-variables-from-javascript take a look at the comments – romeuBraga Apr 25 '18 at 16:35

1 Answers1

1

For built-in substitution variables, there are a few options already, as stated in linked question How to access Oracle Apex variables from Javascript?

But for your own values, you need to put them into an item relevant to HTML. Application Items are useful placeholders, but used by the database, not the rendered page.

Either use protected items on global page (P0_USERROLE), or allocate to JavaScript variable in your declaration section.

var c_userrole = '&USERROLE.';

But if you're using JavaScript to control privileges, be careful the client can't just override the value.

Scott
  • 4,857
  • 3
  • 22
  • 33