XPages: Can I get an attachment name before saving the document?

I have a form with an upload control on it. I’d like to check the filename before saving the document. How can I do that? I tried using @AttachmentNames - which works in the client - but it computes to an empty string in my server side js.

Can this be done?

tia

Subject: Not possible, see this post…

http://www-10.lotus.com/ldd/nd85forum.nsf/ShowMyTopicsAllThreadedweb/7b7b92a479e9ea868525771a0051b696?OpenDocument

Subject: This is possible…

<xp:fileUpload value=“#{currentDocument.file}” id=“newFile”> <xp:eventHandler event=“onchange” submit=“false”>

	<xp:this.script><![CDATA[

var xa=dojo.byId(“#{id:xpAction}”);

var ul=dojo.byId(“#{id:newFile}”);

if(xa) {

xa.value=ul.value;

} else {

alert("There is no xa in Mudville");

} ]]></xp:this.script>

</xp:eventHandler>

</xp:fileUpload>

  • It’s apparently no possible to get the file name using SSJS, but the above copies the file name using CSJS to a plain text field, which SSJS can then read. Works a treat.

Hope this helps…