Solved

How to pass values from a child window to the parent window with the parent window being refreshed.

Posted on 2001-09-13
6
3,180 Views
Last Modified: 2010-05-18
Hi friends,



Iam working on a ERP project.Iam to pass certain values to a pop up window where certain back end process goes on,
once the submit button is clicked I need to

1.Pass the values back to the parent window
2.The pop window should close
3.The parent window should get refreshed.



Iam using asp , javascript and VBscript.


Bye

kala
0
Comment
Question by:kala21
6 Comments
 

Expert Comment

by:prasanna_be_eee
ID: 6481507
hai kala,

        i think you can refer to the parent window(window that opened another window) using window.parent(please check the syntax).

   so when u click the submit button in the new window,
   pass all the values to javascript and use the following

window.current.close(check syntax).
window.parent.href =
         "parent_window_url?var1="+val1+"var2="+val2;

 

0
 
LVL 10

Expert Comment

by:eyal_mt
ID: 6486813
you probably need to use window.opener and not window.parent.

the easiest way to pass parameters back to the parent would be to implement a jscript function in the parent something like:

function myFunc(par1, par2)
{
 doWhateverYouWantHere()
}

then do the following once the submit button is pressed:

function onSubmitClicked
{
window.opener.myFuc(par1, par2);
window.opener.href="whatEverURL";
window.close();
}
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6488783
prasanna_be_eee, please read the EE guidelines on proposing answers - in this case you should have posted a comment.

kala21, please feel free to reject the proposed answer if it does not completely solve your problem.

When the submit button is pressed, is any kind of script on the server called?

Ant
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 1

Accepted Solution

by:
elisch earned 100 total points
ID: 6500540
Use this code in the start page:

<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function button1_onclick() {
     window.open("child.htm", "child", null, "height=200,width=400, resizable=no, status=no,toolbar=no,menubar=no,location=no");
}

//-->
</SCRIPT>
</HEAD>
<BODY>
<INPUT type="text" id=text1 name=text1>
<P><INPUT id=button1 name=button1 type=button value=Button LANGUAGE=javascript onclick="return button1_onclick()"></P>

******
Use this code in the window that opens:

<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function button1_onclick() {
     var winOpener = window.opener;
     winOpener.text1.value = "test value";
     window.close();
}

//-->
</SCRIPT>
</HEAD>
<BODY>
<INPUT type="button" value="Set Textbox Value In Opener" id=button1 name=button1 LANGUAGE=javascript onclick="return button1_onclick()">

************

You can modify it as necessary to pass values back and forth.

CHeers

0
 
LVL 1

Expert Comment

by:ranidchakree
ID: 6515700
hi,

The possible solutions for your questions are:
1) You can use
  opener.document.<field name>.value= <some value>;
2)window.close()
and
3) opener.document.location.reload();

All the best,
Chakree
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6727992
This question is LOCKED with a Proposed Answer.  If it helps you, great, accept it and grade it to close.  If not, reject it and comment as to why or what else is needed.

Few additional experts will join this collaboration effort, once a question has been locked.  Just want to confirm this to you.  If more than one expert helps you, you can always split points or award additional help in a new question, within the same topic area.  If you need help from us, post a zero point question here, and include the link:

http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt

Moondancer
Community Support Moderator @ Experts Exchange

P.S.  Double click your Member Profile, expand VIEW HISTORY to navigate and update all your open questions please.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now