How do i change the url of the parent form from an iFrame form?

I have an iFrame subform on my parent form.  When I submit the form on the Iframe subform, I would like to have a Redirect statement that changes the url of the parent form.

How would I do that?
LVL 5
MitchellVIIAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Kim WalkerConnect With a Mentor Web Programmer/TechnicianCommented:
Response.Redirect() is a server-side function that tells the server how to respond to a request from a client computer. Once the parent page and iFrame have been loaded, Response.Redirect() is powerless to change the content of either without some client-side activity which generates a new request and then it can only direct that response to the source of the request. The server is powerless to control the content of the parent window through the iFrame window. Only client-side scripting can bridge that gap.
0
 
Kim WalkerWeb Programmer/TechnicianCommented:
Do you want to change the url in the parent form "action" attribute or do you want to load a different page in the parent window altogether?

Using javascript, you can access the iFrame parent using the parent object:
parent.document.forms[0].action = 'newurl';
parent.window.location = 'newlocation';

Open in new window

0
 
MitchellVIIAuthor Commented:
I am just looking for the

Response.Redirect()

statement to use in my ASP script.
0
 
MitchellVIIAuthor Commented:
Ah ok.

I guess I'll just have to write a "Thanks!" page to pop up in the iFrame instead of redirecting the parent.
0
 
MitchellVIIAuthor Commented:
Wish the answer was different but it is the correct one :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.