I have a regular list, and the NewForm.aspx page is opened as a modal dialog.
When a user wants to add a new item to that list and adds an attachment to that list, I'd like to be able to change the name of that attachment before the new item gets saved.
So for example: a user adds an attachment to a new list item, and that attachment is called "attachment.docx". The moment the user clicks on the "Save" button to save the new list item to the list, I'd like to change the name of the attachment to "attachment blablabla.docx". When a user then opens that item, the user will see the new name of the attachment.
How can I achieve this? I want to do this with only JavaScript. So far I found several sites mentioning "function PreSaveAction()" but I can't get it to work, it doesn't do an alert or anything.
Any help would be greatly appreciated!