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

Validations for individual items in a dropdown box

I have a form in Nintex that has a dropdown control with many options to choose from. My question is, is there a way to validate for individual choices selected in the dropdown. For example, if "commercial" is selected from the dropdown box can I validate a text box to recognize the selection and apply validations for the choice? Where the text box would be labeled "account #" and validated to only allow so many numeric characters.

0 Kudos
Reply
2 Replies
Workflow Hero

Re: Validations for individual items in a dropdown box

Yep! That's the point of the validation system actually!

If you had a Selection Control, we'll call it 'Customer Type', and a Single Line Text Control (we'll call it 'Account Number'): 

Let's say we gave the Customer Type a few options: 

Because we don't want the user to be able to submit the form without having made a selection first, we'll add a rule to the CustomerType Control using the Rule Editor: 

Instead of typing thing into the 'Condition: Control is invalid if...' text area, click on the formula button (as shown). It will open up the Formula Builder Dialog: 

Inside of this dialog you'll have access to all of the Runtime Functions and Control References you should need to validate that the current control ({Self}) has *some* value:

(Note: Validation Rules are considered to be Invalid when the value returned back from the expression equals true. This is important because as the above information states for the 'isNullOrEmpty()' function, the function will return true whenever the control being evaluated contains no value!)

With just that Rule alone, we prevent the user from Submitting the Form when they haven't made a choice for the Customer Type: 

Now we can add a second Validation Rule to the Account Number Control:

Instead of just using the isNullOrEmpty({ControlSmiley Frustratedelf}) function by itself, we also know that we ONLY want to check the Account Number Control in this way IF the CustomerType Control is equal to the value "Commercial". We do this by once again going into the Formula Builder Dialog and referencing the Named Control for our CustomerType: 

Now that we have added this second rule, if you pick a choice for CustomerType that isn't "Commercial" and hit submit, the form will submit correctly. However if you select "Commercial" and you do not have anything in the Account Number textbox, it will throw a validation error: 

You can get a lot more complex than this and encourage you to seek out various topics about Validation Rules here on the forum, but this should be a good primer to show you how you can accomplish what it is you're trying to do. 

Hope it helps! 

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Validations for individual items in a dropdown box

Thanks for the response N M. After reading it, I have zeroed in on what the question should've been... I want to "format" my single line text box ("account #") to only allow a certain amount of numeric characters for specific options picked in the dropdown box ("commercial"). Sorry for the confusion, I'm fairly new to Nintex.

0 Kudos
Accept as Solution Reply