Link to home
Start Free TrialLog in
Avatar of MisterMart
MisterMart

asked on

Redirect - Target Frame

I have a page with two frames, on of the frames has a form on it. On submitting the form I call an asp page that processes the form and the redirects to another page.

The problem I have is that new page appears in the frame in which the form was. I want to replace both frames, I want the page I am redirecting to, to be the new parent page.
Avatar of FRehman
FRehman

I will tell you later on
You may generate that page after asp processed data:
<html><body onload="window.open('another_page.asp', 'parent_target');"></body></html>

or if you want pass any data to "another page" use:

<html><body onload="document.forms.mf.submit();">
<form name=mf id=mf action="another_page.asp" target="parent_target" method=post>
<input type=hidden name=dataname value=data>
</form></body></html>
If your "return page" is intended ALWAYS to be in its own window, you can add code to that page:

<script>
if (top.location != self.location) {
   top.location = self.location
}
</script>

Your ASP will redirect your page to the frame, but the page will then "break out" of the frameset when it realizes it is not in the top frame.

Should accomplish what you want.

Tom
ASKER CERTIFIED SOLUTION
Avatar of Mark Franz
Mark Franz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Mark:

Ah!  Could be very slick.  The form will post to the top frame and then the redirect (in the action page) will post there?

Sounds good to me.

Tom
In reading the original question I am a bit confussed...  You have a frameset of two frames, lets call them Left and Right.  In the left frame there is a form page that needs to be processed.  In the Right frame is to be the results of the form process, (correct?).  If this is the case, then a simple answer would be the;

<form method=post action=process.asp target=Right>

However, this line confusses me, "I want to replace both frames, I want the page I am redirecting to, to be the new parent page"

Mark
Mark:

My reading of the question is that the form (in the left frame) is being submitted to an ASP which does a response.redirect.  Normally, that will put the redirected page back into the original frame, since ASP has no knowledge of framesets or frames.

I think MisterMart wants to replace both frames with a single document.

<form method=post action=process.asp target=_top> might work, but the code I provided will "bust" the frameset and send the page to the top in any case.

I guess we'll see what seems to work for MM.

Tom
The target=_top will replace any and all framesets that may be loaded as will (I assume) your top.location solution.  
I still am confused with how the page results are suppose to be layed out.

M
I had to do this exact thing.  In order to "break" the frameset, I wrote  Javascript function that fired on a button click event.
<script language="javascript">
<!--
function framebreak()
{
      window.open("utility.asp","_top") ;
}
//-->
</script>

good luck Mister Mart
Avatar of MisterMart

ASKER

Cheers