Copy link to clipboard
Copied
I have been tasked to create a fillable form that at the end of the form allows the user to attach their supporting documentation the the form via an attach button. Currently the attach button on the form allows the user to attach anything they want to the document "as is". Typically on this form the user will attach up to seven supporting documents.
I have been asked if I can alter the form with seven seperate attach buttons that when the user choses to attach that file, the button can be programmed to add a descriptor to file name or to just edit the description box for the file? Example of what I mean: if the user clicks on the "add map" button and uploads file "1155", is it possible to alter the file name through that attach button to make the file attached something like "1155-map" or "map" or change the description as I would if I were to right click the file in the attachment pane and type in "map" under "edit description"?
Appreciate your time.
Copy link to clipboard
Copied
You can't change the name of the attached file, but you can set its Description field to match it, or to be anything else.
In order to do that you need to add the comment using a script and then set its richContents property, as that's what is used for the Description field. For example:
var annot = this.addAnnot({
page: 0,
type: "FileAttachment",
point: [400,500]
});
annot.richContents = [{text: "Map: " + annot.attachment.name}];