This tip allow you to insert various files in a document and refresh it for each upload in a Web aplication.
All the files will be inserted in a Rich Text Field which is named "RTFiles".
The name of the database is "NameBase.nsf"
You need Two Forms and a view :
- the first form is the default form use by the document (Name = DefaultForm).
- the second form is use for insert the files (Name = InsertForm).
- A view named "(ID)" sort this the field IDDDOC of DefaultForm.
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
The DefaultForm is compose by yours fields, a Rich text field which name is "RTFiles" and a Computed Field wich name is "IDDOC" with the @DocumentUniqueID of the document.
" var wintab; var id = document.forms.IDDOC.value; wintab = window.open('/NameBase.nsf/InsertForm?openform&IDDOC=' +id,'','top=150,left=3 50,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=420,height=180'); wintab.focus();"
This action open a new window with the form InsertForm and in the Query_String you have the Id of the document which will receive the files attachments.
In the InsertForm You must create a File Upload, A Field Query_String, A computed Field with the name "IDDOC" and the code :
@Right(Query_String;"&IDDOC="), a field SaveOptions with the value "0" and a Computed Field "NamesFiles" with the value @AttachmentsNames.
In the WebQuerySave event of the InsertForm you will put
And the code for the A-Insert agent is :
This agent will insert the file upload in the RTFiles RixhTextField and Refresh the document.
- This tip only works on Windows or Linux platforms. The reason for this is that the 'WebQuerySave'-agent called 'A-insert' uses the method 'EmbedObject' of the NotesRichTextItem. This method is not supported on MacIntosh, OS/2 and UNIX operating systems.Ronald van Puijenbroek
- This tip works great !!! but..
if 2 users tries to attach a file with same name concurrently, it might produce error message because the file is being extracted to the server's hard drive before re-attaching it to the current document. I understand that this situation would be uncommon, but the website that caters a large number of users might face this problem.Ravi