Apex 5 : Dynamic action set page item value

不羁的心 提交于 2019-12-03 15:18:16

问题


When using the new apex 5 release I'm encountering the following issue:

Can't get the value of page items through plsql:

nv(:P2_TO, :P2_FROM) <<< DOESN'T WORK *I Yes P@_FROM exist and verified
nv(:P2_TO, 'test') <<< DOES WORK

I have tried this both on apex.oracle.com and my own host both wont work.

Some more info:


回答1:


That's pretty logical. You're referencing session state of the variables, and it is likely empty. It's not because items P2_TO or P2_FROM have a value on the page in your browser that they have a value set in session state. For example, load your page, enter a value in P2_FROM. Then click "Session" on your developer toolbar and you'll see there is no value in P2_FROM.
The value in session state can differ from the value on the actual webpage.

This is the exact reason why there is the additional property "Page Items to Submit" with actions which have to communicate with the database (ie perform an ajax request to the webserver). This allows you to define items whose value has to be sent to the server so that in effect you can use their value.

So: for this type of action, add P2_TO to the list of "Page Items to Submit"




回答2:


You could always use apex util:

APEX_UTIL.set_session_state(p_name => 'PX_MY_ITEM', p_value => 'wibble');

Example 1

APEX_UTIL.set_session_state('P1_MY_ITEM','My Text Value');

Example 2

APEX_UTIL.set_session_state('P1_MY_OTHER_ITEM', 42);

Example 3

APEX_UTIL.set_session_state('P1_MY_OTHER_OTHER_ITEM', MY_PLSQL_VARIABLE);


来源:https://stackoverflow.com/questions/29756037/apex-5-dynamic-action-set-page-item-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!