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,182 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
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

773 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