Loading...

Attachments with special characters

Attachments with special characters

  • This topic is empty.
Viewing 1 reply thread
  • Author
    Posts
    • #3901
      Anonymous
      Anonymous
      Participant

      I’ve used on regular forms before some javascript to give the users a message if they are trying to attach a document to a list item that has special characters ([~#%&*{}<>?/+|\”]).  I’ve tried that same script now that I’m using the qListForm on that page and it doesn’t work.

      Here’s what it looks like:

      Untitled.png

      Here’s the code:

      <Script type=”text/javascript”> function PreSaveAction() { var attachment; var filename=””; var fileNameSpecialCharacters = new RegExp(“[~#%&*{}<>;?/+|\”]”); try { attachment = document.getElementById(“idAttachmentsTable”).getElementsByTagName(“span”)[0].firstChild; filename = attachment.data; } catch (e) { } if (fileNameSpecialCharacters.test(filename)) { alert(“Please remove the special characters from the file attachment name.”);return false; } else { return true; } } </script>

      When I do this same thing on a form that is now using a qListForm I get the SharePoint error:

      The following error occurred: The file or folder name contains characters that are not permitted. Please use a different name.

      But the item is still submitted without the attachment.

    • #5092
      Anonymous
      Anonymous
      Participant

      Hello Sandy,

      The special characters cannot be used as a part of file or folder name in Sharepoint.

      If your ListForm is configured to a document library and Form Type is CreateDocument, you will see a description next to the Name field in the form that warns the user not to use these characters, and nothing will be saved if the doc name contains any special character.

      If you have ListForm configured to add new list items along with attachments, then if the attachment file name contains any of these characters, the item will still be saved without the attachment if the form data is valid, but there should not be any errors from the save operation.

      Could you provide some details as to which scenario you are using qListForm, as well as product version and Sharepoint platform, so I can investigate further how to repro the error you encountered?

      Thanks,

      Yuan

Viewing 1 reply thread

You must be logged in to reply to this topic.