SmartForms attachment with special characters

  • 7 August 2014
  • 3 replies
  • 2 views

Badge +5

I have a SmartForm that allows users to upload documents to a SharePoint library. The form fails if the users tries to submit a document with special characters in it (like an &).

 

Is there a way to accomplish either of the following?

1. validate the filename when they hit the submit button on the form, and prevent the rest of the processes from continuing? Maybe throw an error?

2. (preferred) Automatically remove the special characters before running the upload event. I'm using a SmartObject to upload the file

 

Right now the user adds the invalid document and the form just sits there (won't submit). It does not tell them what the issue is.

 

Thanks in advance.


3 replies

Badge +9

The first one you should be able to achieve with a logical rule (K2's equivalent of if, then, else statements). The second one would be doable with customized code searching the strong to find what you want.

Badge +8

When the attachment is loaded, I would send the filename to a datalabel.  On the datalabel, apply an expression that finds and removes all special characters that jack up the upload.  On the "On submit" button, I would use the filename datalabel as the filename for the method.

Userlevel 3
Badge +10

Make sure that if you use a left bracket "[" character in an expression that you escape it by surrounding it with brackets (i.e. [[]).  Not sure about the other characters, but I know that one breaks SmartForms expressions because it is looking for the closing bracket.

Reply