If you only want 1 attachment per doc, and if you want people to override the
existing attachment simply by uploading another, here is the plan:
In the onSubmit, put:
var newfile = document.forms[0].NewFile.value; // NewFile is the ID of the File
Upload Control
if (newfile !="") { // there is a new file to upload
existingFile = document.forms[0].FileName.value; // see FileName field
below
if (existingFile != "") { // remove existing file
document.forms[0]["%%Detach"].value= existingFile // see %%Detach
field below
}
} // end if new file is nothing
Pu this as computed text at the top of the form:
"[<INPUT TYPE=HIDDEN NAME = \"FileName\" VALUE=\"" + @Text(@AttachmentNames) +
"\">]"
This is so JavaScript can access the existing file attachment name. At the
bottom of the form, hidden, put a field called "FileName" so Domino doesn't
have kittens when the doc is saved. Make it editable with no default.
Put in another bit of computed text on the form to define the detach field:
Got it!!
If you only want 1 attachment per doc, and if you want people to override the existing attachment simply by uploading another, here is the plan:
In the onSubmit, put:
var newfile = document.forms[0].NewFile.value; // NewFile is the ID of the File Upload Control
if (newfile !="") { // there is a new file to upload
existingFile = document.forms[0].FileName.value; // see FileName field below if (existingFile != "") { // remove existing file document.forms[0]["%%Detach"].value= existingFile // see %%Detach field below } } // end if new file is nothing
Pu this as computed text at the top of the form:
"[<INPUT TYPE=HIDDEN NAME = \"FileName\" VALUE=\"" + @Text(@AttachmentNames) + "\">]"
This is so JavaScript can access the existing file attachment name. At the bottom of the form, hidden, put a field called "FileName" so Domino doesn't have kittens when the doc is saved. Make it editable with no default.
Put in another bit of computed text on the form to define the detach field:
"[<input type=\"hidden\" name=\"%%Detach\" value=\"\">]"
Tested on IE6 and Notes5
CAroline