最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Oracle Apex Application Item value setting using javascript - Stack Overflow

programmeradmin0浏览0评论

I have an application item- APP_BRCODE (not a page item), if I access the value using &APP_BRCODE. I can retrieve the value, but I can't set the value using javasctipt. $s('APP_BRCODE',value) does not works

I have an application item- APP_BRCODE (not a page item), if I access the value using &APP_BRCODE. I can retrieve the value, but I can't set the value using javasctipt. $s('APP_BRCODE',value) does not works

Share Improve this question asked Jul 12, 2017 at 7:28 NidheeshNidheesh 8125 gold badges25 silver badges49 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

Javascript alone can only change the value of an item that has been rendered on the page - i.e. page items. To change the value of an application item requires a call to the database - either submitting the page or making an AJAX call. You can make an AJAX call from Javascript code something like this:

apex.server.process 
  ( "MY_PROCESS",
    { x01: my_var 
    },
    { success: function( pData ) {
               },
     dataType: "text"
    }
  );

This will set x01 to the value of variable my_var and call the AJAX callback (aka "on demand") PL/SQL process MY_PROCESS.

The PL/SQL process can then set the application item:

:APP_ITEM := apex_application.g_x01;

Seems like a lot of work? Maybe. Without knowing why you want to set an application item from Javascript it's hard to say whether this is worthwhile. You could just set a hidden page item instead?

I end up seeing your reply when I'm looking for solution for the same context.

In Dynamic Actions,

apex.server.process
  ( "upload_ajax_process",

    { x01: this.browserEvent.originalEvent.detail.serverId
    },

    { success: function( pData ) {
               },
     dataType: "text"
    }
  );

In Processing, created call back function "upload_ajax_process" as below. The insert statement inserts the value correctly in the table, however the page display item P12_DOCUMENTURL is not showing the value. What I'm missing here?

begin
:P12_DOCUMENTURL := apex_application.g_x01;

insert into tbl_bs_mentsdoc (mentsdocid, documenturl)
values (seq_mentsdoc_mentsdocid.nextval, apex_application.g_x01);

end;
发布评论

评论列表(0)

  1. 暂无评论