cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Workflow Hero

Validate Multi-Select Choice Field

Jump to solution

Hi!

I'm trying to figure out the correct syntax to validate my multi-select choice field. We want the users to check all the fields that apply:

  • The account was reviewed
  • Account has sufficient funds
  • Account has insufficient funds
  • Agreement on file
  • Agreement not on file

The process will continue based on any combination of choices. However, the only combination that would not be valid would be if the account had both sufficient and insufficient funds. I need a rule that will invalidate this field if "Account has sufficient funds" and "Account has insufficient funds" are both selected. I tried this:

contains(Choice, "Account has sufficient funds") && contains(Choice, "Account has insufficient funds")

and this:

equals(Choice, "Account has sufficient funds") && equals(Choice, "Account has insufficient funds")

but those don't work. I also tried fiddling around with an array, but I'm not very familiar with that and haven't been successful:

!inArray(Choice, "Account has sufficient funds") && inArray(Choice, "Account has insufficient funds")

I feel like I'm close, it seems like these should work. Can I get some guidance?

0 Kudos
Reply
12 Replies
Workflow Hero

Re: Validate Multi-Select Choice Field

Jump to solution

Hi Andrea,

Try using the formula below in your validation rule. It worked for me in Nintex Forms 2013. Make sure you use the Named Control in place of "Choice".

and(contains(Choice, "Account has sufficient funds"), contains(Choice, "Account has insufficient funds"))

Reply
Workflow Hero

Re: Validate Multi-Select Choice Field

Jump to solution

in your formula with inArray(), remove exclamation mark at the very beginning.

you want to invalidate control when both options are selected, ie. when both inArray() checks are true.

Reply
Workflow Hero

Re: Validate Multi-Select Choice Field

Jump to solution

I see the mistake I made when writing both of the formulas. I changed them and tried both, but neither works:

and(contains(AccountReviewforConstraints, "Account has sufficient funds"), contains(AccountReviewforConstraints, "Account has insufficient funds"))

and:

and(inArray(AccountReviewforConstraints, "Account has sufficient funds"), inArray(contains(AccountReviewforConstraints, "Account has insufficient funds"))

I applied a simple validation rule that the field is invalid if isNullorEmpty({Self}) and it works, so there doesn't seem to be a problem with the field. The validation data type is set to "string", so I'm not sure why either formula isn't working.

0 Kudos
Reply
Workflow Hero

Re: Validate Multi-Select Choice Field

Jump to solution

I guess mix of InArray() and contains() is just a typo not your real formula...

if the formula with InArray() doesn't work for you, check the spelling. it should evaluate to true if you select both options

Reply
Workflow Hero

Re: Validate Multi-Select Choice Field

Jump to solution

Here's a screen shot of the validation rule configuration:

Nintex Forms - Multiselect choice column validation 2

Here's a screen shot of the form with the validation rule:

Nintex Forms - Multiselect choice column validation 1

Reply
Workflow Hero

Re: Validate Multi-Select Choice Field

Jump to solution

Good Morning,

I did a little test and found the following works:

This is my test Form with the Choice fields, on the right hand side i used a calculated value control to display what the data in the choice field looks like:

I then constructed my Validation rule like this:

Reply
Workflow Hero

Re: Validate Multi-Select Choice Field

Jump to solution

this is not proper/reliable approach!

if you needed to check for both choice 1 & 3 are checked, and choice 2 would be checked as well your validation wouldn't work.

Reply
Workflow Hero

Re: Validate Multi-Select Choice Field

Jump to solution

Using what I found in my Previous reply and Considering Marian Hatala‌'s response I changed my validation rule to the following:

Formula Builder
contains(ChoiceField, 'Choice 1')&&contains(ChoiceField, 'Choice 2')
This way it invalidates if your selections contain both "Choice 1" AND "Choice 2"
Reply
Workflow Hero

Re: Validate Multi-Select Choice Field

Jump to solution

Is there a character limit in the string? I've done this formula over and over, 4 or 5 times following everyone's suggestions, and it simply doesn't work. The actual selections in the field say this:

Accessible balance sufficient to wire funds: attach DE00 screen print, WIP ticket/offset copies, CLLO/CLW monetary request eform, etc.

Accessible balance not sufficient and Daylight OD Form completed and approved: attach DE00 screen print

Is this too much text or something? I'm using Nintex 2016. I have run into issues with Nintex 2013 with too many rules in a form and I have a lot of rules in this thing. Could that be part of the issue also?

Here is my actual formula:

contains(AccountReviewforConstraints, 'Accessible balance sufficient to wire funds: attach DE00 screen print, WIP ticket/offset copies, CLLO/CLW monetary request eform, etc.') && contains(AccountReviewforConstraints, 'Accessible balance not sufficient and Daylight OD Form completed and approved: attach DE00 screen print')

This looks good to me. This looks like it should work and it doesn't. I've tried single quotes and double quotes. I've tried "&&" and "and()" and nothing works. Is it possible there are too many characters in the string? I am going to fiddle around with it and see what happens.

0 Kudos
Reply