Solved

Submit a form within an iframe along with the main form.

Posted on 2004-03-23
6
1,119 Views
Last Modified: 2006-11-17
Hello I have a main form which contains an iframe. The iframe itself also contains a from. I am trying to submit the iframe form alongside with the parent form. I am just wondering if this is possible without copying the iframe's form values into hidden fields in the main form.

Any thoughts on this are appreciated.

Thank you.
0
Comment
Question by:girionis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
6 Comments
 
LVL 35

Author Comment

by:girionis
ID: 10656042
Just to add, the iframe's form will eventually contain some inputs of type "file".
0
 
LVL 17

Accepted Solution

by:
dorward earned 83 total points
ID: 10656178
No, it is in a seperate document and thus is a seperate form. (And you can't set the value of file inputs using JavaScript, its a sucurity risk).

Why are you using an iframe anyway? Perhaps you would be better off with:

<form>
<input>
<div style="width: 20em; height: 10em; overflow: scroll; border: solid black 1px;">
<input type="file">
</div>
</form>
0
 
LVL 35

Author Comment

by:girionis
ID: 10656412
Hello dorward thank you for your quick reply. Yes I know about the value of the file inputs, that';s why I asked if I can do it without javascript.

I will look into using a <div> element and I will get back to you.
0
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
LVL 35

Author Comment

by:girionis
ID: 10656785
Ok using a div made things better but there is still a problem. I add the <input type="file"> dynamically to the form (we do not know in advance how many files the user will upload) but everytime I add a new file type it resets all the previous ones. I am using the following javascript:

divData.innerHTML = divData + "<input type='file'" + cnt + "'><br>"

where divData is the name of the div element and cnt is a global counter.

If I try to do it differently, adding an element to the node using

document.getElementById('divData').appendChild(inputFile);

where inputFile is the input type file I create,

it just does not send any of those with the request.

Any more thoughts?
0
 
LVL 35

Author Comment

by:girionis
ID: 10656794
Sorry, this:

> divData.innerHTML = divData + "<input type='file'" + cnt + "'><br>"

is actually

divData.innerHTML = divData + "<input type='file' name='fileName'" + cnt + "'><br>"
0
 
LVL 35

Author Comment

by:girionis
ID: 10657644
I will ask this question in the JavaScript category. Thank you for your help.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question