How to add multiple attachments dynamically using javascript?
-
Hi all, I want to add multiple attachments dynamically by using javascript. And this is my code:
<div id="attachments">
</div>
function addMore:
function addMore(id)
{
// create the next id
var newid = eval(++id);// create a new fileupload control string s = ""; // add the control above to the form document.getElementByID('attachments').innerHTML += s;
}
It works fine, but the problem is the value of "file_1" is empty after the function addMore called. So that I can't use method: Request.Files (which gets all fileupload controls' values on the form) on server. Any suggestions? Thanks! -- modified at 6:10 Wednesday 5th April, 2006
-
Hi all, I want to add multiple attachments dynamically by using javascript. And this is my code:
<div id="attachments">
</div>
function addMore:
function addMore(id)
{
// create the next id
var newid = eval(++id);// create a new fileupload control string s = ""; // add the control above to the form document.getElementByID('attachments').innerHTML += s;
}
It works fine, but the problem is the value of "file_1" is empty after the function addMore called. So that I can't use method: Request.Files (which gets all fileupload controls' values on the form) on server. Any suggestions? Thanks! -- modified at 6:10 Wednesday 5th April, 2006
Why don't you try a repeater... I mean, put To display all the Rows create a class with a property and add a item to a ArrayList the Items.... This means to do a PostBack... that is the worst point of my example and the best one of yours... Nevertheless I will try your solution Ricardo Casquete