• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3193
  • Last Modified:

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

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
kala21
Asked:
kala21
1 Solution
 
prasanna_be_eeeCommented:
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
 
eyal_mtCommented:
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
 
a.marshCommented:
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
elischCommented:
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
 
ranidchakreeCommented:
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
 
MoondancerCommented:
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

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now