{"id":4925,"date":"2021-03-11T11:37:23","date_gmt":"2021-03-11T10:37:23","guid":{"rendered":"http:\/\/gpmfactory.com\/?p=4925"},"modified":"2022-06-06T22:27:09","modified_gmt":"2022-06-06T20:27:09","slug":"oracle-apex-calling-a-modal-page-from-javascript","status":"publish","type":"post","link":"https:\/\/gpmfactory.com\/index.php\/2021\/03\/11\/oracle-apex-calling-a-modal-page-from-javascript\/","title":{"rendered":"Oracle APEX &#8211; Calling a Modal Page from Javascript"},"content":{"rendered":"\n<p>Goal: Call a modal page from Javascript code (Dynamic Action or other context) and pass javascript values as parameters.<\/p>\n\n\n\n<p>If the parameter value is stored in a JS variable, no need to call an Ajax process.<\/p>\n\n\n\n<p>Just write this kind of statement:<br>(assuming the modal page is 50)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var pid = '123456';\nvar&nbsp;purl&nbsp;=&nbsp;\"f?p=&amp;APP_ID.:50:&amp;APP_SESSION.:::50:P50_ID:P_ID\";&nbsp;&nbsp;&nbsp;\npurl&nbsp;=&nbsp;purl.replace('P_ID',&nbsp;pid);&nbsp;&nbsp;&nbsp;&nbsp;\napex.navigation.redirect&nbsp;(purl);<\/code><\/pre>\n\n\n\n<p>It&rsquo;s important to do the replacement of the parameter P_ID after declaring the <em>purl <\/em>variable, because APEX will parse the <em>purl <\/em>variable before the JS code be evaluated. (otherwise, the pid parameter value is put a the very end of the generated JS code (cf below)<\/p>\n\n\n\n<p>Dont&rsquo; enclose the P50-ID with # (ie: #P50_ID#) because that doesn&rsquo;t work.<\/p>\n\n\n\n<p>The JS code generated (before variable substitution) looks like that:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>javascript:apex.navigation.dialog('\/ords\/r\/demo\/xxxxx\/change-owner?p50_id=P_ID&amp;clear=50&amp;session=109433551444631&amp;dialogCs=xxxxxxxxxxxxxxxxxxxxxxxxxx',{title:'Change Owner',height:'auto',width:'720',maxWidth:'960',modal:true,dialog:null},'t-Dialog-page--standard '+'',this);<\/code><\/pre>\n\n\n\n<p> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Goal: Call a modal page from Javascript code (Dynamic Action or other context) and pass javascript values as parameters. If the parameter value is&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"ppma_author":[150],"class_list":["post-4925","post","type-post","status-publish","format-standard","hentry","category-non-classe"],"authors":[{"term_id":150,"user_id":1,"is_guest":0,"slug":"admin8700","display_name":"Patrick","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/209d5ed69b74d288390621ab4c1d3773?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/posts\/4925","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/comments?post=4925"}],"version-history":[{"count":2,"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/posts\/4925\/revisions"}],"predecessor-version":[{"id":4991,"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/posts\/4925\/revisions\/4991"}],"wp:attachment":[{"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/media?parent=4925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/categories?post=4925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/tags?post=4925"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/gpmfactory.com\/index.php\/wp-json\/wp\/v2\/ppma_author?post=4925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}