Solved

PostBack of Parent from Child

Posted on 2004-04-14
8
701 Views
Last Modified: 2008-02-01
I have variable sent to parent form from child, then child closes, after which I need to post back the parent form...whats the best way of doing this?
0
Comment
Question by:gtvingo14
  • 4
  • 3
8 Comments
 
LVL 7

Accepted Solution

by:
ramesh12 earned 500 total points
ID: 10824716
<script type="text/javascript" language="javascript">

if (opener && !opener.closed) opener.location.reload(true);
self.close();

</script>

or

http://developer.irt.org/script/1705.htm
0
 
LVL 6

Author Comment

by:gtvingo14
ID: 10825509
where do you put this code at?
0
 
LVL 7

Expert Comment

by:ramesh12
ID: 10826254
In the child window
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 7

Expert Comment

by:ramesh12
ID: 10826284
Whenever you want your parent form to be refreshed like clickking on a close link


use like this

<script type="text/javascript" language="javascript">
function refreshParent()
{
if (opener && !opener.closed) opener.location.reload(true);
self.close();
}
</script>

<a href="javascript:refreshParent();">Close Me </a>
0
 
LVL 6

Author Comment

by:gtvingo14
ID: 10826365
this asks for me if i want to refresh the main window....i dont want it to ask me, just do it....

also, when it does...the pop up comes back
0
 
LVL 7

Expert Comment

by:ramesh12
ID: 10826484
Main form


<html>

<head>
<script language="JavaScript"><!--
var windowReference;

function openPopup() {
  windowReference = window.open('popup.htm','windowName');
  if (!windowReference.opener)
    windowReference.opener = self;
}
//--></script>
</head>

<body>

<form name="formName" onSubmit="alert('submit triggered')">
</form>

</body>

</html>




Child form

<form>
<input type="button" value="Submit" onClick="opener.document.formName.submit();window.close();">
</form>
0
 
LVL 6

Author Comment

by:gtvingo14
ID: 10826995
i cant get this to work either...

i have some vb code that is triggered by the button....Button html is below

<asp:button id="Button1" style="Z-INDEX: 131; LEFT: 392px; POSITION: absolute; TOP: 424px" runat="server" Height="24" Width="104px" Text="Deny Request" BackColor="LightCoral" BorderColor="LightCoral"></asp:button>
0
 
LVL 9

Expert Comment

by:pepsichris
ID: 10832975
If you've already got the rest working, then in the body tag of the child:

<body onunload="opener.document.yourform.submit();">

Change "yourform" to whatever you called your form in the parent.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This video teaches users how to migrate an existing Wordpress website to a new domain.

813 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

17 Experts available now in Live!

Get 1:1 Help Now