This tip allows you to delete several files attachments included in a rich text item. You can use it with the tips "Insert various files attachments on the Web."
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
This tip works only on NT and Linux server.
The name of the database is "NameBase.nsf".
You need Two Forms and a view:
- the first form is the default form used by the document (Name = DefaultForm).
- the second form is used for deleting t>he files (Name = DeleteForm).
The DefaultForm is composed by : -yours fields,
-a Rich text field which name is "RTFiles"
-and a Computed Field which name is "IDDOC" with the @DocumentUniqueID of the document.
var wintab; var id = document.forms.IDDOC.value; wintab = window.open('/NameBase.nsf/DeleteForm?openform&IDDOC=' +id,'','top=150,left=350,toolbar=no,location=no,directories=no, status=no,menubar=no,scrollbars=no,resizable=no,width=420,height=180'); wintab.focus();
This action opens a new window with the form DeleteForm, and in the Query_String, you have the Id of the document in which you want delete the file attachments.
In the DeleteForm, you must create:
- a Field Query_String = Query_String,
- a computed Field with the name "IDDOC" and the code is @Right(Query_String;"&IDDOC=")
- a field SaveOptions with the value "0".
- a multivaluated list field named "DelFiles" which the formula selection is
res := @DbLookup("":"NoCache";"":"";"(ID)";iddoc;2);@If(@IsError(res) | res =""; ""; res);
DelFiles is used for the selection of the files that the user want delete.
In the WebQuerySave event of the DeleteForm, you will put :
And the code for the A-Delete agent is :
This agent will delete the files selected with the "DelFiles" Field and refresh the current document.