Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Copy File Field Value to Dynamic File Field Value

Reply
Thread Tools

Copy File Field Value to Dynamic File Field Value

 
 
Darko
Guest
Posts: n/a
 
      11-08-2007
On Nov 8, 4:55 pm, VUNETdotUS <(E-Mail Removed)> wrote:
> On Nov 8, 9:52 am, Darko <(E-Mail Removed)> wrote:
>
>
>
> > On Nov 8, 1:36 pm, SAM <(E-Mail Removed)>
> > wrote:

>
> > > Darko a écrit :

>
> > > > As for cloneNode, once it works in Mozilla, it will
> > > > work in IE. I guarantee.

>
> > > Hu ?

>
> > >http://stephane.moriaux.pagesperso-o...nerHTML_danger
> > > with tests for innerHTML and cloneNode
> > > to try with IE *and* compliant browsers

>
> > > results are a little different ... !

>
> > > --
> > > sm

>
> > Look at my last post. I admitted Randy Webb was right about not being
> > able to successfully
> > clone the file input. Your quoting my "I guarantee" section doesn't
> > make me feel good
> > about my self

>
> > But, cloning itself indeed does work with Internet Explorer, it just
> > doesn't copy the object's
> > value, too, as Webb already said, when input type=file is object of
> > cloning.
> > The cloning itself, however, works and the link you've provided should
> > work in IE.

>
> The solution is ready! As genius, as simple... May not be the most
> perfect but may work for me fine.
> So, instead of copying or cloning, I'd just use that object itself and
> append it to a new form:
>
> <input onchange="doit(this)">
> function doit(obj){
> var go = new dothat(obj);}
>
> function dothat(obj){
> //code is a sample........
> var input = obj
> this.form = document.createElemet("form")
> this.form.appendChild(input)
> //...........
> this.form.submit()
>
> }
>
> Note: the input disappears from the page, but I would hide it anyway
> because I do not need it. I can replace with loading progress image
> and then a link when the file is uploaded.
> What do you think? Would this cause any issues?
> Thanks


I guess not. I like it. It's just not acceptable in general, when one
doesn't want it to disappear from
the page, but in cases where you'd hide it anyway, which is the
majority I think, it should work.

Indeed it is simple, and indeed we didn't think of it (maybe because
we didn't presume you wouldn't mind
it disappear, so it was subconsciously excluded from the list of
available ideas). Good work.

 
Reply With Quote
 
 
 
 
s0lnic
Guest
Posts: n/a
 
      11-08-2007
VUNETdotUS wrote:

> The solution is ready! As genius, as simple... May not be the most
> perfect but may work for me fine.
> So, instead of copying or cloning, I'd just use that object itself and
> append it to a new form:
>
> <input onchange="doit(this)">
> function doit(obj){
> var go = new dothat(obj);
> }
> function dothat(obj){
> //code is a sample........
> var input = obj
> this.form = document.createElemet("form")
> this.form.appendChild(input)
> //...........
> this.form.submit()
> }
>
> Note: the input disappears from the page, but I would hide it anyway
> because I do not need it. I can replace with loading progress image
> and then a link when the file is uploaded.
> What do you think? Would this cause any issues?


Yeah, I did almost the same thing in one application some time ago which
works great. The only difference is that I was appending a fieldset which
contains multiple file inputs to a new form. It works very well

--
# Regards || piotr[.]solnica[at]gmail[.]com || jid : http://www.velocityreviews.com/forums/(E-Mail Removed) #
# s0lnic || http://blog.solnic.in5.pl || icq : 385935391 #
 
Reply With Quote
 
 
 
 
s0lnic
Guest
Posts: n/a
 
      11-08-2007
VUNETdotUS wrote:

> do you mean I have to submit the original for and then repaint it
> plugging all values in? I do not know really...


In case you have other fields in that form, not only file inputs, then
submitting the original form doesn't make any sense of course. Your
solution with appending file inputs to a new form is far better then what
I've suggested.

--
# Regards || piotr[.]solnica[at]gmail[.]com || jid : (E-Mail Removed) #
# s0lnic || http://blog.solnic.in5.pl || icq : 385935391 #
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      11-09-2007
s0lnic wrote:
> VUNETdotUS wrote:
>> I need it to upload the files without refreshing the page. So, my new
>> hidden, dynamically created DOM form is submitting file value to iframe
>> and user keeps on working with current visible form.

>
> Oh, so submit the form and dynamically create a new one...user won't see
> anything, don't worry. This method works on every major browser.


Unless, of course, for some reason either client-side script support or
sufficient DOM support is not available.

Bad idea.


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
 
Reply With Quote
 
Darko
Guest
Posts: n/a
 
      11-10-2007
On Nov 9, 9:33 pm, Thomas 'PointedEars' Lahn <(E-Mail Removed)>
wrote:
> s0lnic wrote:
> > VUNETdotUS wrote:
> >> I need it to upload the files without refreshing the page. So, my new
> >> hidden, dynamically created DOM form is submitting file value to iframe
> >> and user keeps on working with current visible form.

>
> > Oh, so submit the form and dynamically create a new one...user won't see
> > anything, don't worry. This method works on every major browser.

>
> Unless, of course, for some reason either client-side script support or
> sufficient DOM support is not available.
>
> Bad idea.
>
> PointedEars
> --
> Anyone who slaps a 'this page is best viewed with Browser X' label on
> a Web page appears to be yearning for the bad old days, before the Web,
> when you had very little chance of reading a document written on another
> computer, another word processor, or another network. -- Tim Berners-Lee


Unless he's got lynx

 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      11-10-2007
Darko wrote:
> [...] Thomas 'PointedEars' Lahn [...] wrote:
>> s0lnic wrote:
>>> VUNETdotUS wrote:
>>>> I need it to upload the files without refreshing the page. So, my new
>>>> hidden, dynamically created DOM form is submitting file value to iframe
>>>> and user keeps on working with current visible form.
>>> Oh, so submit the form and dynamically create a new one...user won't see
>>> anything, don't worry. This method works on every major browser.

>> Unless, of course, for some reason either client-side script support or
>> sufficient DOM support is not available.
>>
>> Bad idea.
>> [...]

>
> Unless he's got lynx


This is by far not the only one possibility for that.

Please trim your quotes, see
http://www.jibbering.com/faq/faq_notes/clj_posts.html


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$(E-Mail Removed)>
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript validation for a not required field, field is onlyrequired if another field has a value jr Javascript 3 07-08-2010 10:33 AM
what is Deep Copy, shallow copy and bitwises copy.? saxenavaibhav17@gmail.com C++ 26 09-01-2006 09:37 PM
is dict.copy() a deep copy or a shallow copy Alex Python 2 09-05-2005 07:01 AM
copy and paste form RTF document into field in asp form cause it to bypass field length and javascript validation - how to overcome? NotGiven Javascript 3 05-13-2004 12:15 AM
copy and paste form RTF document into field in asp form cause it to bypass field length and javascript validation - how to overcome? NotGiven ASP General 3 05-13-2004 12:15 AM



Advertisments