473,803 Members | 3,738 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cloneNode'ing file input

Hello,

In Mozilla (Firefox 1.0.7) I can cloneNode a file input element that
has a selected file value and appendChild it to another form without a
problem.

IE 6 loses the selected file value. Is this a bug with IE that it
loses the value, or with FF that it keeps it?

I'd really like to be able to maintain the selected file value in IE.

Does anyone have any advice or experience with cloneNode that can
provide some insight?

I have not tried this on any browsers other than IE 6 and FF 1.0.7.

Thank you,
Garth

Oct 19 '05 #1
7 3508
On 19 Oct 2005 13:25:47 -0700, ga****@gmail.co m wrote:
In Mozilla (Firefox 1.0.7) I can cloneNode a file input element that
has a selected file value and appendChild it to another form without a
problem.

IE 6 loses the selected file value. Is this a bug with IE that it
loses the value, or with FF that it keeps it?


I don't think either could truly be considered a bug, but I'm afraid
you'll just have to live with IE's behaviour.

Jim.
Oct 19 '05 #2
Thank you Jim for the honest if somewhat disheartening response.

All of this is an attempt to submit one or more files without
disturbing the page that the file inputs are sitting on. The rest of
the form data is submitted using the xmlhttprequest object via post.

If I can send these files using "ajax" style techniques that would
solve my problem entirely, but I haven't found a way to do that. I
also haven't found anyone else who has done it either, so I'm still
assuming that it can't be done.

Anyone have anything further to offer before I move on to a different
approach? (darn IE)

Oct 19 '05 #3
On 19 Oct 2005 13:52:02 -0700, ga****@gmail.co m wrote:
If I can send these files using "ajax" style techniques that would
solve my problem entirely, but I haven't found a way to do that. I
also haven't found anyone else who has done it either, so I'm still
assuming that it can't be done.


Oh no, that's easy, just give your form a target of an IFRAME with the
name you want, then the submission goes to the IFRAME, the main
document isn't disturbed and you use normal cross frame scripting to
get the results back.

People have been doing it for years, long before ajax have ceased to
be just another mediocre european football team...

Jim.
Oct 19 '05 #4
On Wed, 19 Oct 2005 20:38:24 GMT, ji*@jibbering.c om (Jim Ley) wrote:
On 19 Oct 2005 13:25:47 -0700, ga****@gmail.co m wrote:
In Mozilla (Firefox 1.0.7) I can cloneNode a file input element that
has a selected file value and appendChild it to another form without a
problem.

IE 6 loses the selected file value. Is this a bug with IE that it
loses the value, or with FF that it keeps it?


I don't think either could truly be considered a bug, but I'm afraid
you'll just have to live with IE's behaviour.

Jim.


I'd consider Firefox's behaviour to be (slightly) less secure than
IE's behaviour. After all, is the value of a file input on one form
really applicable to a file input cloned and placed on another form?

In a browser that doesn't allow linking to file:/// links from the
local hard disk when the page is loaded from http://, retaining the
value of a cloned file input seems odd, out-of-place and unintended to
me. So IE's behaviour seems the "more correct" of the two to me.

I'm sure an equally weak argument could be made as to why it is okay
and proper to retain the value of a cloned file input.

--
Grant Wagner <sq*******@yaho o.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq
Oct 19 '05 #5
On Wed, 19 Oct 2005 20:58:20 GMT, Grant Wagner <sq*******@yaho o.com>
wrote:
I'd consider Firefox's behaviour to be (slightly) less secure than
IE's behaviour. After all, is the value of a file input on one form
really applicable to a file input cloned and placed on another form?

In a browser that doesn't allow linking to file:/// links from the
local hard disk when the page is loaded from http://, retaining the
value of a cloned file input seems odd, out-of-place and unintended to
me. So IE's behaviour seems the "more correct" of the two to me.

I'm sure an equally weak argument could be made as to why it is okay
and proper to retain the value of a cloned file input.


I couldn't come up with a scenario whereby cloning an input into
another form would not be equivalent to just changing the action on
the form that contained it originally, but there may well be.

I would lean towards IE too being the one I'd prefer, but can't come
up with a concrete reason why. It might be interesting to see what
Opera does here as it did (does?) let you specify a default value -
prompting the user to confirm the submissoin if the user doesn't
change it.

Cheers,

Jim.
Oct 19 '05 #6
I actually already have an iframe in place which served as the target
for the dynamically created form which I had the cloned file inputs
appendChilded to.

I'll switch around the machinery and just have the original form be
submitted to the iframe. I had a good reason not to submit the
original form, but in the fervor of trying to get the file inputs to be
cloned "properly" I've forgotten why.

Thanks to everyone who has contributed!

Oct 19 '05 #7
VK

Grant Wagner wrote:
I'd consider Firefox's behaviour to be (slightly) less secure than
IE's behaviour. After all, is the value of a file input on one form
really applicable to a file input cloned and placed on another form?

In a browser that doesn't allow linking to file:/// links from the
local hard disk when the page is loaded from http://, retaining the
value of a cloned file input seems odd, out-of-place and unintended to
me. So IE's behaviour seems the "more correct" of the two to me.

I'm sure an equally weak argument could be made as to why it is okay
and proper to retain the value of a cloned file input.


I have big eye on both of them (FF and IE). Since beginning of times
you either couldn't get fileInput.value at all using script or
(starting 4th) *only file name w/o path*. Now both are glad to tell me
the full path including drive name even for server-loaded pages. Tested
on IE6 SP1 and FF1.0.7

What a hey (to say the softest) is going on?

Oct 19 '05 #8

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

Similar topics

2
6967
by: J.R | last post by:
Greetings, I'm adding dynamically created input type='file' controls via JavaScript. However when I try to access they do not seem to be returned in the form collection. Any ideas? Thanks, John.
1
2126
by: MonkeyBoy | last post by:
I am doing some some HTML manipulation in client-side script (IE5.x and IE6.x browsers only). Something like.. var tmpHTML = oTable.outerHTML // do something to the HTML her oTable.outerHTML = tmpHTML Before the changes, client-side .Net field validators (RegularExpressionValidator, RangeValidator, etc.) work fine... after the changes, the modified HTML works correctly but the validators stop functioning. Seems that the onchange handler...
1
1264
by: Petr Felzmann | last post by:
Hi, why the duration of call the CloneNode(true) is steadily increasing? First call is 0.004s and 100th is 0.16s! XML file is 5kB only, no disk swap. XmlDataDocument xml = new XmlDataDocument(); xml.Load(@"C:\foo.xml"); for(int i = 0; i < 100; i++) { XmlNode node = xml.CloneNode(true);
0
1919
by: Sullivan WxPyQtKinter | last post by:
Hi, I am now using minidom for my current development. I use cloneNode method in Element object, but it just does not work. The test code is very simple as follows: =========CODE============== from xml.dom.minidom import * a=Element('see') print a.toprettyxml() b=a.cloneNode(True)
2
4603
by: Csaba Gabor | last post by:
One of the things that I never understood was the motivation for not being able to iterate over the event listeners added via ..addEventListener It's particularly vexing because if you do element.cloneNode(bDeep), you frequently get a stunted clone, often with several key features missing, and one of these is associated event handlers. Of course, it could be the case that the event handlers have a closure including a reference to the...
1
6685
by: jaktharkhan | last post by:
Hi, I really really need help in trying to figure out how can I do a CloneNode on an Iframe where the cloned IFRAME clones with all its contents?. Basically what I am doing is dynamically building a table with Iframes inside it. The problem is I just want to build one Iframe because the contents of it can be very complex. After my Iframe is built I just want to clone the iframe as many times as I need later. I cannot use an HTML file and...
19
6076
by: VUNETdotUS | last post by:
Firefox showed me a security error when I was copying a value of file field object into new DOM created input file field. Can I do something about it? Thanks.
2
2022
by: Alino | last post by:
hello, i need help with this javascript <script type="text/javascript"> function addfile() { var obj = document.getElementById("sprytextfield2").cloneNode(true); document.body.appendChild(obj); } </script>
0
9703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9565
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10550
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10295
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2972
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.