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: 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…