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(",", [ColumnName])),TRUE),IF(ISERROR(FIND("&", [ColumnName])),TRUE),IF(ISERROR(FIND("!", [ColumnName])),TRUE),IF(ISERROR(FIND("@", [ColumnName])),TRUE),IF(ISERROR(FIND("~", [ColumnName])),TRUE),IF(ISERROR(FIND("#", [ColumnName])),TRUE),IF(ISERROR(FIND("$", [ColumnName])),TRUE),IF(ISERROR(FIND("%", [ColumnName])),TRUE),IF(ISERROR(FIND("*", [ColumnName])),TRUE),IF(ISERROR(FIND("(", [ColumnName])),TRUE),IF(ISERROR(FIND(")", [ColumnName])),TRUE),IF(ISERROR(FIND("-", [ColumnName])),TRUE),IF(ISERROR(FIND("+", [ColumnName])),TRUE),IF(ISERROR(FIND(":", [ColumnName])),TRUE),IF(ISERROR(FIND(";", [ColumnName])),TRUE),IF(ISERROR(FIND("[", [ColumnName])),TRUE),IF(ISERROR(FIND("]", [ColumnName])),TRUE),IF(ISERROR(FIND(".", [ColumnName])),TRUE),IF(ISERROR(FIND("/", [ColumnName])),TRUE),IF(ISERROR(FIND("\", [ColumnName])),TRUE))
Also, I have a choice column (A) (radio button) that has three options. I would like one of the options to be invisible unless a different choice column (B) (drop down) has a particular option selected. I know this is possible, but I'm not sure how.
But it's not playing nice with question marks and nesting IFs.
Thanks for any assistance!
Solved! Go to Solution.
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
your validation then might look like
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
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.
To make our message, we need to create a Validation Rule
The rule setup will look like this:
Here is the code, explicitly (you can just copy / paste that right in):
{Control:Self}.match(/[^A-Za-z0-9\-\_\ ]/gi) !== null
The Regex (/[^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.
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!