Hi,
I have a form where attachments can be added.
Those attachment values will be wrapped into html code so it will be links.
As they can click on a + sign to add more input fields, the amount of input fields is dynamic.
For each input tag there is, this value will be written to a hidden form field called “url” before it will be sent to the database.
Now it works and adds data to the database… but not for every form field apparently. Only for 1 new field…
function getAttachmentValues(){
var field = document.getElementById('wisselvelden').getElementsByTagName('input');
var attachment = "";
alert(field.length); // this alerts the correct nr of fields
for(var i=0; i<field.length;i++){
if(field[i].name ==='attac' && field[i].value !== ""){
attachment = "<a href='"+field[i].value+"' target='_blank'>Attachment "+[i]+"<\\/a><br \\/>";
// url document below is a hidden field in the form where the values will be written into
document.messageform.url.value += attachment;
}
attachment = "";
} alert(document.messageform.url.value); // shows that the url does not contain the values of every input field... :s
}
Anyone had this problem?