Skip to main content

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. 

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.

221401_pastedImage_1.png

The relevant control properties are shown below:

Yes/No

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:

221402_pastedImage_11.png

Option selected (revealing Single line textbox):

221403_pastedImage_12.png

Attempted Save with textbox empty:

221404_pastedImage_13.png

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.


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


 


google street view


Reply