2 Replies Latest reply: Apr 4, 2013 5:11 PM by zooid RSS

    Call a procedure from within javascript

    zooid
      Hi,

      I would like some help on the following please.

      I have a javascript script on the page "Function and Global Variable Declaration" area:
      function openUrl(pUrl) {
        window.open(pUrl,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=1024, height=768");
      }
      In the same page a have a number of classic reports. A number of columns in each of these reports define a link. The link parameters for all of this columns are set as follow:
      Target: URL
      URL: javascript:openUrl('http://#SERVERNAME#:9704/xmlpserver/Publications/Dock_Report.xdo?_xpf=&_xpt=0&_xdo=%2FPublications%2FDock_Report.xdo&_xmode=4&_paramsID_USU=#ID_USU#&_paramsIDCR=#IDCR#&_paramsIDCU=#IDCU#&_xt=DPol_Layout&_xf=pdf&_xautorun=true');
      As you see, the application user click the link on the report column and a popup is generated displaying the report. This all works fine.

      My requirement is to call a procedure passing the augments which are included in the column link which was clicked by the application user.
      #ID_USU#
      #IDCR#
      #IDCU#
      My question is how can achieve this considering that the url is inside a javascript call?

      Can I use the Javascritp define in the page to extract this details and then use javascript to call a procedure?

      Any help, pointers, ideas, anything is welcome.

      Application Express 4.0.2.00.07

      Thank you

      Edited by: zooid on Apr 4, 2013 10:47 PM
        • 1. Re: Call a procedure from within javascript
          trent
          Have you seen this javascript API? http://docs.oracle.com/cd/E17556_01/doc/apirefs.40/e15519/javascript_api.htm#BGBJHEHG

          There's the handy function: apex.submit(pOptions);

          specify URL target as:

          javascript:rowClick('#ID_USU#', '#IDCRM#', '#IDCU#');

          Then add a function to your page somewhere:
          function rowClick(idUsu, idcrm idcu){
            
            openUrl(/*url*/);
            apex.submit({request: "SOME_REQUEST_VALUE", set: {Px_ID_USU: idUsu, Px_IDCRM: idcrm, Px_IDCU: idcu}});
          
          }
          (Where you have page items for each of the items you want to set.

          THen you can have a PL/SQL page process, conditional of request = expression 1, expression 1 = SOME_REQUEST_VALUE

          And do whatever you like ;-)
          • 2. Re: Call a procedure from within javascript
            zooid
            Trent,

            To cool.

            Thank you, I owe you one.