Skip to main content
Nintex Community Menu Bar

Filename entry in Responsive form

Filenames do not like special characters in most operating systems. How to tackle this in a responsive form or in a workflow itself? Here is a step-by-step on how I do it.

This is the workflow we are going to create:

24643i860AF983F49974C4.png

I’ll show you two ways to do it:

  1.        In the form
  2.        In the workflow using the Regular Expression action.

The Form

Click the Start event and select Form. Create something like this form:

24644iBA75C28065D57402.png

Let’s look at the fields:

The Filename is just a normal Text (short) field with these properties set:

24645i5A5243953E9D4EC3.png

As you can see I’ve set the maximum amount of characters to 50. Keep filenames short!

The tooltip says “Characters allowed are numbers, letters, underscore, hyphen and space. All other characters are replaced by an underscore.” (For simplicity I don't accept any other characters here)

 

The ‘clean’ filename is shown in the label field below the filename field:

24646iDAC804D5F88D6DAF.png

We are using a Variable here.

Go to the Variable tab in the forms designer and define this variable:

24647i4BDA5A02E1223187.png

The function ‘replace’ is used. This function works like a Regular Expression.

If you’re not familiar with variables or regular expressions, please read the Nintex help files on this. Good bedtime reading.

Lookup the Replace function under functions and see the build in help:

24648i095215BB67B71F86.png

Important note Be very precise in copying the ‘Text Regular Expression’ as shown or copy it :

replace(

 

Note the space after the hyphen! Basically what it says in Regex slang is: accept all number 0-9, all lower- and uppercase character a-z, hyphens and spaces. Everything else : replace by an underscore. Do not put the underscore itself in the string of accepted characters as this might give unwanted results:  no need to replace an underscore by an underscore…

 

Now you can already preview the form and it will show you the clean version of what you input:

24649i1B27C29BEFD51794.png

Why is there a red line around the input field? Well, just to show that you are able to respond to the input directly, I have added a rule that makes the box red when the resulting filename will be different from the input filename. Such a rule looks like this:

24650i3B54ADA5D938DEF4.png

 

You can turn this rule into a Submit rule if you want to stop the user from proceeding until a valid filename has been entered.

 

The Regex action

Now let’s get back into the workflow and see that we can achieve the similar effect using the magical (and mystical) Regular Expression action.

24651i325C55E4CDDC5958.png

 

This will have the exact same effect but now from within the workflow itself. Useful if the filename string comes from somewhere else than a form such as a SharePoint list.

 

The Test

Now our workflow test run will look like this:

24654i6C0F532145422340.png

 

24655i9BB8514D205581D8.png

Hope this is useful for you too! Thanks for the Kudo.

Thanks for the post @Wouter


Reply