473,396 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

submit to iframe in new window

I have a page and when the user clicks a button I want to open up a new
window that has an iframe in it and I want to direct the page to submit
to that iframe.

My code looks like:

var mywin;
mywin =
window.open('','view_report','width='+mywidth+',he ight=425,top=50,left=0,scrollbars=yes,toolbar=yes, resizable=yes');

mywin.document.write("<html><title>my report</title><body>");
mywin.document.write("<iframe src='tmp.cfm' name='miketest'
id='miketest' height='100%' width='100%'></iframe>");
mywin.document.write("</body></html>");

document.report.method = 'post';
var post_script = mywin.document.getElementById('miketest');
document.report.target = post_script;
document.report.submit();

This does not work but I think you get the jest of it.

Any help is appreciated.

Mike

Dec 20 '05 #1
3 5544
I also tried:

var post_script = mywin.frames['miketest'];

I get 2 windows open up so document.report.target is not getting
set properly.

I forgot to mention that i had set:

document.report.action = another.cfm

Mike

Dec 20 '05 #2
mike wrote:
var mywin;
mywin =
window.open('','view_report','width='+mywidth+',he ight=425,top=50,left=0,scrollbars=yes,toolbar=yes, resizable=yes');
mywin.document.write("<html><title>my report</title><body>");
Trying to open new windows: Bad Thing.
Accessing properties without feature-testing: Worse Thing.
Calling methods without feature-testing: Worst Thing.
Not reading any newsgroup or documentation before coding: insane.

function isMethodType(s)
{
return (s == "function" || s == "object");
}

var d;
if (mywin && !mywin.closed
&& (d = mywin.document)
&& isMethodType(typeof d.write))
{
mywin.document.write("<iframe src='tmp.cfm' name='miketest'
id='miketest' height='100%' width='100%'></iframe>");
mywin.document.write("</body></html>");
Do not call HTMLDocument::write() consecutively if the written markup
belongs together. Such is inefficient and, more important, error-prone.

HTMLDocument::open() and HTMLDocument::close() are missing. The generated
document will not be Valid HTML. The generating document is not Valid HTML
iff this code is used as content of the `script' element as ETAGO
delimiters ("</") are not properly escaped ("<\/").

d.open();
d.write(
'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"\n'
+ ' "http://www.w3.org/TR/html4/loose.dtd">\n'
+ '<html>\n'
+ ' <head>\n'
+ ' <meta http-equiv="Content-Type"'
+ ' content="text/html; charset=ISO-8859-1">\n'
+ ' <title>my report<\/title>\n'
+ ' <\/head>\n'
+ ' <body>'
+ ' <iframe src="tmp.cfm" name="miketest" height="100%"'
+ ' width="100%"><\/iframe>'
+ ' <\/body>\n'
+ '<\/html>');
d.close();
document.report.method = 'post';
var post_script = mywin.document.getElementById('miketest');
document.report.target = post_script;
`post_script' has to refer to a string value, as the value of the `target'
property/attribute has to be one. Both standards compliant and backwards
compatible referencing is

document.forms['report'].target = 'miketest';

<URL:http://www.w3.org/TR/DOM-Level-2-HTML/>
document.report.submit();

This does not work [...]


"Does not work" is a useless error description. [psf 4.11]

<URL:http://jibbering.com/faq/#FAQ4_43>
HTH

PointedEars
Dec 20 '05 #3
On 2005-12-19, mike <hi****@charter.net> wrote:

I have a page and when the user clicks a button I want to open up a new
window that has an iframe in it and I want to direct the page to submit
to that iframe.
???
you submit to the server, do you want to submit from the iframe ?
My code looks like:

var mywin;
mywin =
window.open('','view_report','width='+mywidth+',he ight=425,top=50,left=0,scrollbars=yes,toolbar=yes, resizable=yes');

mywin.document.write("<html><title>my report</title><body>");
mywin.document.write("<iframe src='tmp.cfm' name='miketest'
id='miketest' height='100%' width='100%'></iframe>");
mywin.document.write("</body></html>");

document.report.method = 'post';
var post_script = mywin.document.getElementById('miketest');
document.report.target = post_script;
document.report.submit();

you get it to work you neeed to copy the form into the iframe and submit that.


--

Bye.
Jasen
Dec 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Paul Oakfleet | last post by:
The script below will disable Submit button until user accept terms, and will redirect user to another page after clicking on Submit button. The script seems to work fine on my PC (Windows XP,...
2
by: Halldór Ísak Gylfason | last post by:
In my application I have an iframe that is empty (and not visible) initially, however when a user presses a button a form is programmatically submitted and the target is set to the IFrame. I...
1
by: gzannd | last post by:
I have a problem with submitting a form to a PHP page through a dynamically created IFRAME in IE7. This code works fine in Firefox. However, IE7 submits an empty form--the correct PHP page is...
4
by: linuskamb | last post by:
I have a problem which is a slight twist on discussions I have seen previously here and elsewhere. I have a form with an input select combo box whose target is an internal static iframe. The form...
3
by: CAG | last post by:
Hello, I have following scenario in my web application. I want to load different web forms in single iframe. Iframe in contained in an ASP page. ASP page has “Submit” button, which submits iframe...
1
by: Anderh | last post by:
hi all, I have using iframe for call php file called , I wnat submit this form inside iframe from parent form in main page but I codnt make it. <input type="button" id="s" name="s" value="submit...
1
by: IframeLearner | last post by:
Hi , I am trying to upload a file from a parent.jsp using Iframes. From Parent page. I have to save Subject, Desc, File and file name. to upload the file i am using Iframe. I want the...
2
by: Sharkie | last post by:
I have a document with couple of iframes. One of the iframes has a simple form. When this form is submitted I would like to display the results in whole (top) window as opposed to just in the...
4
by: vunet | last post by:
Hello, My HTML form submits some values to a hidden iframe. However, this is done for file upload fields only. After file uploading is finished I am using this form to submit all other data...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.