Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Adding form fields dynamicly

Reply
Thread Tools

Adding form fields dynamicly

 
 
emperor-laban@home.se
Guest
Posts: n/a
 
      01-21-2005
How can I add more <input type="file" /> -fields by the click of a
button? The idea is that the clients should be able to upload a number
of files from the same form, but I shouldn't need to know how many
fields they need to begin with. Would be good to have an option to
remove fields as well.

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      01-21-2005


http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> How can I add more <input type="file" /> -fields by the click of a
> button? The idea is that the clients should be able to upload a number
> of files from the same form, but I shouldn't need to know how many
> fields they need to begin with. Would be good to have an option to
> remove fields as well.


You can create elements with the factory method createElement of the
document and then insert it as needed in your document with e.g.
appendChild called on the element you want to insert the input it, for
instance the form element object or one of its descendants:
var input;
if (document.createElement && (input =
document.createElement('input'))) {
input.type = 'file';
input.name = 'file1';
input.id = 'file1';
form.appendChild(input);
}

--

Martin Honnen
http://JavaScript.FAQTs.com/
 
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
Is it possible to add a server-side form dynamicly? Owen Wong ASP .Net 0 09-12-2006 01:24 AM
Dynamicly adding controls after Page_Load event GS ASP .Net 4 02-15-2006 08:27 AM
dynamicly updating an objects fields kyle.tk Python 2 08-31-2005 02:16 PM
Creating a form dynamicly DaWoE ASP .Net 2 09-01-2004 10:39 AM
Dynamicly get the form name at server =?Utf-8?B?WWFuaXI=?= ASP .Net 1 04-19-2004 05:35 PM



Advertisments