Solved

How do I disable a required(mandatory) field based on a choice?

  • 7 October 2016
  • 8 replies
  • 501 views

Badge +3

Here's my problem, and I am sure others have come across this.

 

I have a drop with 2 choices, A and B

I have a panel containing multiple required fields.

This panel should be hidden and all fields disabled when the drop is set to B.

Using rules allows me to hide the panel and fields but the disable option does not take effect.

 

I have tried custom validation using these steps http://blog.qumsieh.ca/2013/01/14/nintex-forms-basi-validation/comment-page-1/#comment-281416 but havn't worked out how to disable the validation if the panel is hidden.

I've scoured google but don't have a clear step by step.

 

Please can someone assist or provide a link to steps that work?

 

Thanks

Jon

icon

Best answer by xMikeX 7 October 2016, 03:04

View original

8 replies

Userlevel 5
Badge +12

Hello,

I am going to offer you a simple solution, avoiding custom validation and using the built in rules functionality of the product.   As you have seen, disabling a control does not disable a validation rule placed on it.   The good news is that you can add functionality to your validation rules to make this work nicely.

Here is how you can modify your Nintex Validation rules to get this to work:

and(isNullOrEmpty({Self}), equals(YourChoiceControl,"A"))

The rule above first checks to see if the control {Self} is null or empty which would be replaced by your current rule, the second part is the magic that says make this validation happen only if YourChoiceControl is equal to A.   In other words, the validation won't be activated if your user selected B.

Hope that helped!

Mike

Badge +3

Thanks Mike, that worked a treat!

I tried something similar but think my formula must have been wrong.

Badge +3

Hi Mike,

I may have jumped the gun on this.

I have a form in which the rules will disable the field sucessfully, however, on submit the fields error out as they are required.

In the above snippet the highlighted fields are required fields and are disabled when the guest button is selected. unfortunately, they error on submit.

The form has 2 panels, one for "Guest" and another for "Member or Staff"

I've tried other variations on formulas e.g. equals(Tabs, "Guest")

My end goal is to have a rule that will disable(and allow submitting) and hide the panel not selected.

Any ideas?

Cheers

Jon

Userlevel 5
Badge +12

Hi John,

Remove the "required" aspect from the fields in the backing SharePoint list, and let the Nintex Forms validation rules do the trick on the front end making them required only when necessary (as described by the rule) .  This will get you the flexibility that you need.   Otherwise, if you are forcing the fields to be required at the Sharepoint list level, then there is nothing Nintex can do on the front end to prevent you from having to enter data.  Nintex will simply respect the "required" settings of the SharePoint list.

Hopefully that answered your question or gives you further direction on how to achieve this.

Thanks,

Mike

Badge +3

Thanks Mike, that makes sense. I hadn't thought of it in terms of SharePoint vs Nintex.

Hi, Mike!

I have almost the same problem the only difference is that I use checkbox with rules that allows me to hide the panel and fields but the disable option of the validation does not take effect. Will this formula be also applicable to my case? Thanks!

Userlevel 5
Badge +12

Hello TC N,

The rule may have to be modified slightly in your case - when using a checkbox in a rule, simply the name of the checkbox itself inserted by double clicking on it in the rules pane -   in other words a reference to a checkbox will return true if checked and false if not.  If you let me know what you want to happen when the checkbox is checked or unchecked I can probably elaborate more clearly.

Thanks

Mike

Hi Mike,


If you're still available, how do you change the "Mandatory" field in SPO?


Thanks!

Reply