Solved

PostBack of Parent from Child

Posted on 2004-04-14
8
696 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
Comment Utility
<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
Comment Utility
where do you put this code at?
0
 
LVL 7

Expert Comment

by:ramesh12
Comment Utility
In the child window
0
 
LVL 7

Expert Comment

by:ramesh12
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 6

Author Comment

by:gtvingo14
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

772 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

10 Experts available now in Live!

Get 1:1 Help Now