This discussion is archived
5 Replies Latest reply: Nov 19, 2012 4:12 AM by 974898 RSS

passing values from one page to pop up window page in apex

974898 Newbie
Currently Being Moderated
Hi all,

i have created java script for opening a new window to send mail from apex.

<script language="JavaScript" type="text/javascript">

function send_mails(template_id) {
window.open('https://hrssc-in.oraclecorp.com/pls/apex/f?p=154:15:&SESSION.:::15:P15_VENDOR_CODE,P15_MONTH,P15_YEAR,P15_DISCREPANCY_DETAILS_DL,P15_DISCREPANCY_DETAILS_CS,P15_DISCREPANCY_DETAILS_PF,P15_DISCREPANCY_DETAILS_ESI,P15_TEMPLATE_ID:&P2_VENDOR_NAME.,&P2_MONTH.,&P2_YEAR.,&P2_DISCREPANCY_DETAILS_DL.,&P2_DISCREPANCY_DETAILS_CS.,&P2_DISCREPANCY_DETAILS_PF.,&P2_DISCREPANCY_DETAILS_ESI.,'+template_id,null,"height=500,width=1200,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes");}


</script>

i can pass value from page2 to page15 using the above code only if i choose submitt page for items(page action when value changed).

If there is any other way to pass values without submitting the items (in page action tab).

can anybody help me to solve this issue

Thanks in advance,

Anees
  • 1. Re: passing values from one page to pop up window page in apex
    Prabodh Guru
    Currently Being Moderated
    Hi Anees,
    i have created java script for opening a new window to send mail from apex.
    <script language="JavaScript" type="text/javascript">

    function send_mails(template_id) {
    window.open('https://hrssc-in.oraclecorp.com/pls/apex/f?p=154:15:&SESSION.:::15:P15_VENDOR_CODE,P15_MONTH,P15_YEAR,P15_DISCREPANCY_DETAILS_DL,P15_DISCREPANCY_DETAILS_CS,P15_DISCREPANCY_DETAILS_PF,P15_DISCREPANCY_DETAILS_ESI,P15_TEMPLATE_ID:&P2_VENDOR_NAME.,&P2_MONTH.,&P2_YEAR.,&P2_DISCREPANCY_DETAILS_DL.,&P2_DISCREPANCY_DETAILS_CS.,&P2_DISCREPANCY_DETAILS_PF.,&P2_DISCREPANCY_DETAILS_ESI.,'+template_id,null,"height=500,width=1200,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes");}

    </script>

    i can pass value from page2 to page15 using the above code only if i choose submitt page for items(page action when value changed).

    If there is any other way to pass values without submitting the items (in page action tab).

    can anybody help me to solve this issue

    Thanks in advance,>

    A. Always post code snippets in &#123;code&#125; tags as explained in the FAQ
    B. The site you refer to is internal to Oracle.
    C. When you pass parameters using ampersand-dot notation you are picking up the values from the session state, hence the need to submit (to save to session state)
    D. When in javascripts use $v API . Try using it in your current code. E.g. replace &P2_VENDOR_NAME. by $v('P2_VENDOR_NAME') and so on. This is pass the current value in the DOM instead of session state.
    E. Passing values in URL is not secure. Passing through session state is safer.
    F. You have not mentioned the Apex version . If you are on Apex 4.x, try using DA to set the session state values as an alternative to passing through URL and /or using $v API

    Cheers,
  • 2. Re: passing values from one page to pop up window page in apex
    974898 Newbie
    Currently Being Moderated
    i just replaced ampresand-dot values

    { <script language="JavaScript" type="text/javascript">

    function send_mails(template_id) {
    window.open('https://hrssc-in.oraclecorp.com/pls/apex/f?p=&APP_ID.:15:&SESSION.:::15:P15_VENDOR_CODE,P15_MONTH,P15_TEMPLATE_ID:$v('P2_VENDOR_NAME'),$v('P2_MONTH'),'+template_id,null,"height=500,width=1200,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes");}

    </script> }

    pop up window is not opening now..

    how could i re arrange the script?

    Thanks
  • 3. Re: passing values from one page to pop up window page in apex
    Prabodh Guru
    Currently Being Moderated
    Its the single quotes enclosing https. Try this
    <script language="JavaScript" type="text/javascript">
    
    function send_mails(template_id) {
    window.open("https://hrssc-in.oraclecorp.com/pls/apex/f?p=&APP_ID.:15:&SESSION.:::15:P15_VENDOR_CODE,P15_MONTH,P15_TEMPLATE_ID:$v('P2_VENDOR_NAME'),$v('P2_MONTH'),"+template_id,null,"height=500,width=1200,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes");}
    
    </script> 
    Cheers,
  • 4. Re: passing values from one page to pop up window page in apex
    evrm Pro
    Currently Being Moderated
    Hi,

    the v$ function you use to get the values of the items can't be used as part of the parameter for window.open.
    Try to concatenate the v$ function calls in the parameter
    <script language="JavaScript" type="text/javascript">
    
    function send_mails(template_id) {
       window.open('https://hrssc-in.oraclecorp.com/pls/apex/f?p=&APP_ID.:15:&SESSION.:::15:P15_VENDOR_CODE,P15_MONTH,P15_TEMPLATE_ID:' + $v('P2_VENDOR_NAME') + ',' + $v('P2_MONTH') + ',' + template_id,null,'height=500,width=1200,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes');
    }
    
    </script>
    What does the template_id mean in the parameter string?

    regards,
    Erik-jan
  • 5. Re: passing values from one page to pop up window page in apex
    974898 Newbie
    Currently Being Moderated
    Thanks alot both of you...my problem has been solved...Now its working without any problem.

    Dear erik,

    I have 4 templates in my database,so i am fetching these templates(template body,template sub) using template_id,

    Passing the template_id value in button

    Action When Button Clicked : redirect to url

    URL Target: javascript:send_mails(3);

    Thanks & Regards,

    Anees

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points