Skip to Content
author's profile photo Former Member
Former Member

passing parameter to new window from window.open

hello all, i'm using EP5.0 sp5.

in my iview A on a htmlb:button press i want to launch a

iview B in a new window, and i want to pass a paramter to

that new window. i've tried a couple methods of doing this,

but they've all had problems of one kind or another.

my code looks something like this:

iview A: <hbj:button

id="myButton"

design="STANDARD"

text="Press Me"

onClientClick="jsOnClick()"

onClick="click"

</hbj:button>

.... later on ....

<script language="javascript">

function jsReportMyOccurrence() {

win = window.open('/irj/servlet/prt/portal/prtroot/package.iviewB','iviewB','scrollbars=1,resizable=1,width=700,height=550,left=100');

}

</script>

and i want to pass in a param 'issue'

i've tried passing this in via ecpm & IPortalComponentSession which doesn't work since both are bound to a page, and when i call window.open() on iview B i's considered a different page and gets it's own ecpf object & IPortalComponentSession.

I then tried passing in the param via the underlying HttpSession but that also doesn't work since the new window opens up and queries the variable before the

button:jspdynPage's onClick method is called to set the variable in the HttpSession. Now i'm considering if it's possible to push the variable as a GET or POST param when i call window.open, but i'm not sure how to accomplish this in iview A or how i'd look for that param from iview B's JSPDynPage. help would be greatly appreciated.

--vat

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 04, 2005 at 11:26 AM

    I have done something similar on EP5 SP5.

    The requirement was when you click on a link you open a new iview and you want it to retrieve a parameter. We also had some problems with EPCF so we used to a standard query string.

    So the easiest way to do this is to create a javascript function which will use window.open to take you to your iview, I suggest using URLGenerator for this. Then append on ?myparam=value onto the end you should be able to retrieve this from the request object in the doInitialisation method.

    You will end up with something like http://mydomain.com/irj/servlet....../myiview?myparam=myvalue.

    I hope this helps.

    Nick Mitchell

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 04, 2005 at 06:11 PM

    there is some useful information on the urlgenerator in the pdk and some sample code.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      hrmm..

      thanks for your help nick. i found out the info on URLGenerator, and that side works fine. it generates a url

      and does it very clearly, now the problem is how to 'capture' that data from the other iview.

      this is the code that gets generated (I did a view source in ie on the iviewA) :

      (cleaned up, and obfuscated a bit)

      window.open(

      '/irj/servlet/prt/portal/prtroot/package.iviewB!3fissueNumber!3d000800000460',

      'issueEntry',

      'location=1,scrollbars=1,resizable=1,width=700,height=550,left=100');

      and in iviewB.java i have this code :

      public void doInitialization() {

      IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();

      String issue = (String) request.getValue("issueNumber");

      ((IPortalComponentResponse) this.getResponse()).write("<script language='javascript'> alert('" + issue + "');</script>");

      }

      the alert box pops up with 'null'. so it appears that

      i'm not getting the value. do i need to use a different method, or something?

  • author's profile photo Former Member
    Former Member
    Posted on Jan 13, 2005 at 05:24 PM

    Sorry I haven't replied up to now.

    From what I can see you aren't actually passing any parameters along the query string. Might be worth checking this first.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 13, 2005 at 05:26 PM

    Sorry it won't let me edit by response before but if you use in iview A.

    window.open(

    '/irj/servlet/prt/portal/prtroot/package.iviewB!3fissueNumber!3d000800000460?issuenumber=2',

    'issueEntry',

    'location=1,scrollbars=1,resizable=1,width=700,height=550,left=100');

    does it pick anything up?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.