Skip to main content

I have a list with a Nintex form.  I would like to do these with Nintex form rules rather than Column / List validation if possible.

First off, I need to disallow forbidden characters from the item title field, with a message that says something like "Your title has forbidden characters...." if someone tries to enter them. 

(I'm using this field to create an excel filename with a workflow later on.  Using a regex to scrub the user entry, replace forbidden characters with "-" and update the title with the scrubbed value is working, except when the scrubbed value is a duplicate to one that already exists in the list)

I've been trying to use something like this:

=AND(IF(ISERROR(FIND(",", aColumnName])),TRUE),IF(ISERROR(FIND("&", aColumnName])),TRUE),IF(ISERROR(FIND("!", aColumnName])),TRUE),IF(ISERROR(FIND("@", aColumnName])),TRUE),IF(ISERROR(FIND("~", aColumnName])),TRUE),IF(ISERROR(FIND("#", aColumnName])),TRUE),IF(ISERROR(FIND("$", aColumnName])),TRUE),IF(ISERROR(FIND("%", aColumnName])),TRUE),IF(ISERROR(FIND("*", aColumnName])),TRUE),IF(ISERROR(FIND("(", aColumnName])),TRUE),IF(ISERROR(FIND(")", aColumnName])),TRUE),IF(ISERROR(FIND("-", aColumnName])),TRUE),IF(ISERROR(FIND("+", aColumnName])),TRUE),IF(ISERROR(FIND(":", aColumnName])),TRUE),IF(ISERROR(FIND(";", aColumnName])),TRUE),IF(ISERROR(FIND("n", aColumnName])),TRUE),IF(ISERROR(FIND("]", aColumnName])),TRUE),IF(ISERROR(FIND(".", aColumnName])),TRUE),IF(ISERROR(FIND("/", aColumnName])),TRUE),IF(ISERROR(FIND(""

but your formula is from list (field) validation, right?

this will not work as nintex form validation.

I think regex is the best option for your validation. it certainly can spot your forbidden characters, even if they appear several times within the input.

see following formula

211749_pastedImage_2.png

211748_pastedImage_1.png

your validation then might look like

211756_pastedImage_9.png

211751_pastedImage_4.png

211752_pastedImage_5.png

211753_pastedImage_6.png

211754_pastedImage_7.png

211755_pastedImage_8.png


Marian,

Thanks for the reply.  My field is a Single Line Textbox and I'm not sure how to get the "Formula" dialog that you have there (you're using a calculated value and the Control Settings are different).


Never mind I think I've seen what you did there....let me try.


I'm not having a lot of luck getting this to work, but also, my main goal was to disallow forbidden characters, not replace them.  I want to drive the behavior in my users that they shouldn't use forbidden characters in the item titles.


my main goal was to disallow forbidden characters, not replace them

that's exactly what my above example is about.

first two screenshots are a reply to your statement that you didn't succeed with regular expressions. they just shows that with regular expression you can determine any of your forbidden characters, and regardless of how many time they appear in input string.

rest of the screenshot visualize the validation rule formula you need.

the formula works so that if there appear any of forbidden characters in input string, it's replaced with a dash. replace result is compared to original input string. if they do not match there definitely had to be a forbidden character. if they match, nothing was replaced, so no forbidden character in input.

aren't examples of different inputs I provided clear enough?

just copy&paste it and it should work happy.png


First off, I need to disallow forbidden characters from the item title field, with a message that says something like "Your title has forbidden characters...." if someone tries to enter them. 

Alright. This is easily doable. If you want to just replace all of the characters that are invalid with valid ones, that's also doable, but it would remove any reason to show a warning, and doesn't encourage your users to get it right... So...

Let's inform the user that they have made a mistake (and force them to change their filename for us)!

Here's a typical Single Line Text control that has been linked to the Title column.

211773_pastedImage_2.png

To make our message, we need to create a Validation Rule

211774_pastedImage_3.png

The rule setup will look like this: 

211784_pastedImage_4.png

Here is the code, explicitly (you can just copy / paste that right in): 

{Control:Self}.match(/n^A-Za-z0-9-_ ]/gi) !== null

The Regex (/e^A-Za-z0-9-_ ]/g) is trying to match any character that ISN'T A through Z (uppercase), a through z (lowercase), 0 through 9, a dash -, an underscore _, or a space. An attempt to use any other character will result in an error being thrown. 

211786_pastedImage_6.png

If there are characters that are allowed which have been missed by the above regex, you can add them at your discretion (or remove them if I have included an invalid character, like, space). 

As for your other topic about the hiding of select options, I would create a different forum topic to discuss that, so that we don't muddy the waters on this one. 

Does this help get you going in the right direction? 


Worked like a charm, thanks for making it easy!


Reply