473,406 Members | 2,707 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,406 software developers and data experts.

posting content to an iframe

I have a page with a form as follows:

<form name="updfrm" method="post" action="update_db.cfm">
<input type="text" name="myfield" value="stuff">
<button onclick="sub_this();">press here</button>
</form>

normally I would either 1) let this form post to this window, or 2)
open a window and post to it.

I'd like to try posting that using an iframe.

So, I create that iframe in the same page as the form like:

<div style="display:none">
<iframe src="" id="update_iframe" name="update_iframe">
</iframe>
</div>

The script that takes the content from the form and updates the
database is called update_db.cfm.

So, my function looks like:

function sub_this()
{
var mycgi = "update_db.cfm";
document.getElementById('update_iframe').src=mycgi ;
document.updfrm.target = document.frames['update_iframe'];
document.updfrm.submit();
}

My browser IE6 does not like this at all. Its dieing and barfing.

Anyone see any problems here.

I have gotten this to work using get, but not post. Using get my
sub_this function would look like:

function sub_this()
{
var mycgi = "update_db.cfm?thecontent=" +
document.updfrm.elements['myfield'].value;
document.getElementById('update_iframe').src=mycgi ;
}

I don't really want to use get because I'd have to encode every
variable in the url. Some of them may be long.

Mike

Nov 10 '05 #1
2 1619

mike wrote:
I have a page with a form as follows:

<form name="updfrm" method="post" action="update_db.cfm">
<input type="text" name="myfield" value="stuff">
<button onclick="sub_this();">press here</button>
</form>

normally I would either 1) let this form post to this window, or 2)
open a window and post to it.

I'd like to try posting that using an iframe.

So, I create that iframe in the same page as the form like:

<div style="display:none">
<iframe src="" id="update_iframe" name="update_iframe">
</iframe>
</div>

The script that takes the content from the form and updates the
database is called update_db.cfm.

So, my function looks like:

function sub_this()
{
var mycgi = "update_db.cfm";
document.getElementById('update_iframe').src=mycgi ;
document.updfrm.target = document.frames['update_iframe'];
document.updfrm.submit();
}


If the page with your form is already in the iframe, there is no need
to do a target. Just let the form submit and let it post back to the
same page.

Nov 10 '05 #2
Its not in the iframe ..... I plan on using the iframe for many things.

Nov 10 '05 #3

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

Similar topics

7
by: Lorenzo Vaina | last post by:
Can i get the content of an URL and put it in a variable using javascript? I want js execute different operations varying a file that is on internet. Thanks, regards.
1
by: Peter | last post by:
Hi, Does anyone know of how I could dynamically resize an iframe based on the content's height (for IE) so that no scrollbar appears for the iframe? The content will be from a different domain....
5
by: SigRob | last post by:
I have PAGE1 with the link to PAGE2 with iframe. (iframe load several naked html). I want to add directive to the link to point sprcific content of iframe. to make it clear link on PAGE1 ->...
2
by: J-T | last post by:
Hello, I have an iframe which its scr is set to show a url (am image) .I am put this iframe on a user control and I am loading that user control dynamically to my Default.aspx.Now I need to...
1
by: bjorn2k | last post by:
Hi All, I'm working on a webpage. In this webpage i have an IFrame. I load html files in this I frame, but then i get those scrollbars which i want to get rid off. My Iframe has a fixed width....
9
by: aatcbbtccctc | last post by:
Hi folks I've googled for an answer to this, with no success. Can someone please jump in, and put me out of my misery! (I'm sure it's quite simple) I have an invisible IFRAME, and a visible...
6
by: Duncan | last post by:
Does anybody know how the following can be acheived using html or xhtml? I need to present colleagues with a 'to-do' list. Lets say the list has ten or so jobs and each job consists of five or...
1
by: brussel | last post by:
I'm trying to copy information in one iframe to another iframe with javascript. I am using firefox and information from my local domain so there are no security issues. However I'm just not getting...
9
by: jad2006 | last post by:
Hi guys We have a requirement like in one iframe we have to show one site and in another iframe we have to show some other external site, we did it using <iframe src="http://www.a.com">...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.