File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Using Javascript for generating a form element Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Using Javascript for generating a form element" Watch "Using Javascript for generating a form element" New topic

Using Javascript for generating a form element

Ketan Joshi
Ranch Hand

Joined: Oct 09, 2005
Posts: 66
Hello All

I currently have a form which has one form field <input type='file'> to upload a file

I want to provide a button on the same page and if it is clicked, user should get another browse button to upload another file on the same page.

Is this possible using JavaScript or what is the best option where I can have multiple files uploaded

I dont want the page to be filled with browse boxes.They should be generated as per users choice when he clicks the button which has text "More files" on it.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60059

You can create them on-the-fly either through use of the innerHTML property, or by creating the DOM elements "by hand".
[ April 20, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Using Javascript for generating a form element
Similar Threads
Want a suggestion regarding upload and save in database using struts 2.0
Filter the file extensions
Access Denied When Submitting File Upload
Calling a jsp page from javascript
Filtering the file names