Conditional Validation

Jump to solution

Using Nintex Forms 2016 in conjunction with SharePoint Server 2016. I have created some conditional formatting and custom validation. I have 3 Yes/No Check Boxes and 1 Single Line Text Box associated with each. Using Rules, I successfully hid each SLTB until it's associated Y/N Box is checked. Within the Control Settings of the SLTBs I have: Validation, Required = Expression, if(Y/N_Box_Control _Structure). The goal is to make the associated SLTBs required if and only if the Y/N Box = Yes/True. All Y/N Boxes are No (unchecked) by default. 

0 Kudos
2 Replies

Re: Conditional Validation

Jump to solution

I suggest you handle the validation logic via a rule on the control(s) rather than as a property of the Single line textbox. Here's a quick solution showing a single checkbox which, when selected, makes the Single line textbox visible and becomes a mandatory field upon submission.

The Form Design

This will demonstrate the concept using just one Yes/No control with an associated Single line text box, but you should be able to easily replicate these to suit your use case.

The relevant control properties are shown below:


Name: CtlCheckbox

Single line textbox

This control needs two rules applied: one is a formatting rule to show/hide based on whether the Yes/No option is selected, and the other is the validation rule to ensure this field is not empty upon submission.

Formatting rule

Condition: not(CtlCheckbox)

Formatting: Hide=yes

Validation rule

Condition: CtlCheckbox && isNullOrEmpty({Self})

The Result

Default, option not selected:

Option selected (revealing Single line textbox):

Attempted Save with textbox empty:

As suggested, applying validation form rules to a control, instead of the control's validation property, provides a little more flexibility in that you can reference Named Controls. This allows you to construct your validation formula based on other controls in your form, which the user will interact with / change at runtime (unlike Item Properties).

Hope this helps.


Re: Conditional Validation

Jump to solution

Thank you Michaela, it worked, I could troubleshoot using your suggestion.


google street view

0 Kudos