Allora ho dato un'occhiata al codice... vedi se così va meglio:
a questo punto credo che il parametro max sia utilizzabile sensatamentecodice:function addUpload(fileFieldName){ if (max == 0 || currentUploads <= max) { nameFile=fileFieldName; currentUploads++; if (currentUploads>0) document.getElementById('addupload').childNodes[0].data='Aggiungi file'; // First, clone the hidden attachment section var newFields = document.getElementById('attachment').cloneNode(true); newFields.id = ''; // Make the new attachments section visible newFields.style.display = 'block'; // loop through tags in the new Attachment section // and set ID and NAME properties // // NOTE: the control names for the Description Input // field and the file input field are created // by appending the currentUploads variable // value to the nameFile and nameDesc values // respectively // // In terms of Xaraya, this means you'll need to name your // DD properties will need names like the following: // "AttachmentDesc1" // "AttachmentFile1" // "AttachmentDesc2" // "AttachmentFile2" // "AttachmentDesc3" // "AttachmentFile3" // et cetera... var newField = newFields.childNodes; for (var i=0;i<newField.length;i++){ if (newField[i].name==nameFile){ newField[i].id=nameFile+currentUploads; newField[i].name=nameFile+'[]'; //newField[i].name=nameFile+currentUploads; } } // Insert our new Attachment section into the Attachments Div // on the form... var insertHere = document.getElementById('attachmentmarker'); insertHere.parentNode.insertBefore(newFields,insertHere); } // chiudo l'if aperto all'inizio }

Rispondi quotando