Solved

Nintex New Responsive Form - Validation Rule no Spaces allowed

  • 25 January 2023
  • 4 replies
  • 241 views

Badge +1

I was wondering if there was an easy way to create a validation rule to not allow spaces in a single line of text field. I am using a New responsive form and need to prevent users from including spaces in this particular field.

icon

Best answer by Garrett 25 January 2023, 16:17

View original

4 replies

Userlevel 3
Badge +9

Hi JosePC. Good question!

This is what I normally do (maybe it can be done better but this works for sure. I am not a Regular Expression Wizard so I prefer to skip that).

First I define text field in my form:

Plain short text field. No settings changed

then I create a variable in the form:

it replaces the spaces in my text with just another character.

Then I create a SUBMIT rule that checks these two against one another. When different there must have been spaces.

 

Then I test it in preview. Enter a value with spaces and click Submit:

Hope this helps.

PS. If you would only allow e.g. letters, numbers, spaces, hyphens and underscores (as for filenames) you might be all right with something like this in the settings of the form variable:

 

Userlevel 5
Badge +13

You can do that by configuring Input Validation with a regular expression. Below are the steps:

1. Go to the configuration for the Text - Short field.
2.. Configure the Input Validation.

  • Input validation = Regular expression
  • Pattern = /s
  • Custom Regular expression message = Whatever you would like

This will trigger this validation in the filed if a user enters a space in the text. They will see the message and not be able to submit the form until correcting.

 

Userlevel 6
Badge +16

Hi @JosePC 

One method is to simply replace “ “ spaces with “” blank using Form Rules. Rule activates when the field lose focus. 

The Form Rules

Formula

 

Badge +1

Thank you very much for responding. I have tested all three and they work flawlessly. 

Reply