Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 2nd, 2004, 02:48 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default Forcing a form in the parent's parent to submit

This is the situation: I have a page with a form. In this page is an iframe. In this iframe is a frames page, and in one of the frames is a function that forces the form in the parent-est page to submit, but it doesn't work.

I am using IE6, and it pops up an error message oddly without the line, error number and description. Then it pops up another error box that says "an error has occured in this dialog: error 84, unspecified error."

Here is my code:
Code:
HTML_to_export = doc.body.innerHTML;
parent.parent.document.open();
//this line causes it. without this line I get parent.parent is not an object
parent.parent.document.forms[0].newvalue.value = HTML_to_export;
parent.parent.document.forms[0].submit();
Has anyone else encountered this problem?

Thanks,

Snib

<><
__________________
-Snib - http://www.snibworks.com
Where will you be in 100 years?
Reply With Quote
  #2 (permalink)  
Old June 2nd, 2004, 03:52 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Basically you're saying that you have a nested frame many frames down. If you want the topmost frame, then the "top" property should do it.

top.document.forms[0].submit();

HTH!

Regards,
Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::
Reply With Quote
  #3 (permalink)  
Old June 2nd, 2004, 04:10 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Rich: same thing happens, replacing all parent.parent with top.

Thanks for helping,

Snib

<><
Reply With Quote
  #4 (permalink)  
Old June 2nd, 2004, 08:21 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Let me add some info....

These work:

alert(parent.parent.location);
alert(top.location);

None of these do:

document.forms['myform']....
document.forms[0]....
document.forms.myform....
document.myform....

They all return something like "document.forms[...] is null or not an object".

Thanks in advance.

Snib

<><
Reply With Quote
  #5 (permalink)  
Old June 3rd, 2004, 11:26 AM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

FYI, I solved this problem.

I don't know what was wrong, but I used a workaround: I made a form in the window that contains the force submit function, and gave it the attribute target="_top". It all works now!

Thanks,

Snib

<><
Reply With Quote
  #6 (permalink)  
Old June 21st, 2004, 05:55 PM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, I'd love to know more about how you resolved this issue as I am having the same one. I have a form with an iframe that contains another form. I need to be able to submit the top level form when a button is clicked (after the button has executed it's server side code). Any help is appreciated. Thanks.

Reply With Quote
  #7 (permalink)  
Old June 22nd, 2004, 10:42 AM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: California, USA
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

Dear TammyWoods:
Have u ever check Target attribute on [u]Form</u>

Always:),
Hovik Melkomian.
Reply With Quote
  #8 (permalink)  
Old June 22nd, 2004, 11:03 AM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried using the target attribute, but what happened there was the form in the iframe popped up into a new page.... it didn't work... so I must be missing something here?

Reply With Quote
  #9 (permalink)  
Old June 22nd, 2004, 11:06 AM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: California, USA
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

NO u should use ur Frame name for Target.

Always:),
Hovik Melkomian.
Reply With Quote
  #10 (permalink)  
Old June 22nd, 2004, 01:47 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I set my target attribute to _top.

HTH,

Snib

<><
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Forcing postback on parent page from modal dialog gp_mk ASP.NET 1.0 and 1.1 Professional 8 February 20th, 2007 12:44 PM
parent form from child form - urgent plz netfresher C# 1 November 8th, 2006 06:59 PM
Compare parent's attribute with grand parent's one scubaduba XSLT 3 November 29th, 2004 12:26 PM
Forcing a new rec in a subform from a diff form DrSnuggles Access 1 September 15th, 2004 10:13 AM
How can we submit a form without a submit butto phpsharma BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 4 October 20th, 2003 08:50 AM



All times are GMT -4. The time now is 08:44 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.