cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
harryr
Nintex Newbie

Validation rule if panel is not hidden by another rule

Jump to solution

Hi

Would anyone know how to set a validation rule to trigger if a panel is made visible by another Formatting type rule and the people picker in that panel is empty?

I want to prompt the user to fill out the people picker in the panel if it is not hidden.

Thanks in advance.

Labels: (1)
Tags (2)
0 Kudos
Reply
4 Replies
MegaJerk
Nintex Newbie

Re: Validation rule if panel is not hidden by another rule

Jump to solution

Without seeing your existing Rule or Form, it should still be relatively straight forward. 

Consider the Rule that is hiding the Panel and Controls. 

If "X" is True => Hide Panel 

That means that if you wanted to make a validation rule inside of the panel to consider it's visibility, you'd need to reverse the logic! 

If "X" is False => Validate Control

Additionally, because you want validation to fail if the field is empty you can combine that idea with the first part: 

If "X" is False AND This Control is Empty => Control is Invalid! 

In practice the rule would look something similar to: 

YesNo_Control_Reference && isNullOrEmpty(People_Control_Reference)

Here is a simple mockup using a Yes / No checkbox and a Panel with a People Picker Control inside of it: 


Here is the Rule for the Panel: 

(Notice the "!" at the beginning of the Control Name Reference. That 'inverts' the boolean value of the control. So an Unchecked Control will equal true instead of false, and a checked control will equal false instead of true. This way the Panel stays hidden until we check the box!) 

Now we just need to add a rule to our People Picker Control: 

If you click on the little 'F of x' (aka: f(x)) button, you'll be presented with the Formula Builder where you'll have access to all of your Control References and Runtime Functions which you can easily insert into your formula as shown. 

(Note: For a Control to show up in the 'Named Controls' tab, it must be given an actual name otherwise it will not be there. In this case I have named the Yes/No Control as 'Show_Panel') 

Now when you Preview the form, you'll see no Panel: 

Until you check the 'Show Panel' box:

If you try to save without putting something in there, you'll be greeted with an error:

Inserting a valid person though will allow you to pass the validation test: 

I hope that this helps you along your way. 

0 Kudos
Reply
harryr
Nintex Newbie

Re: Validation rule if panel is not hidden by another rule

Jump to solution

@MegaJerk 

 

Thanks for that. I have a panel that unhides based on multiple conditions:

 

Form your post I guessed that perhaps I need ot apply the validation to the people picker inside the panel, so, building on the rule that shows the panel, I added an AND clause to check the peoiple picker but without success:

 

or(contains(BProjectCategory,"ProjectTypeA"),or(contains(BProjectCategory,"ProjectTypeB"),or(contains(BProjectCategory,"ProjectTypeC"),and(isNullOrEmpty({Self})))))

The rule makes the field show in red but after entering a name in the people picker, it still doesn't validate.

 

I have used this structure on another rule that worked fine but can't get this to work.

 

0 Kudos
Reply
harryr
Nintex Newbie

Re: Validation rule if panel is not hidden by another rule

Jump to solution

Ok I got this to work.

 

My panel is hidden using this rule:

 

or(contains(ProjectCategory,"ProjectA"),or(contains(ProjectCategory,"ProjectB"),or(contains(ProjectCategory,"ProjectC"),and(not(contains(RiskBox,"Low"))))))

(When the ProjectCategory is not one of the three values AND RiskBox is Low, it shows.

 

On the poepl picker control I added a new validation rule and used the code below. I had to repeat th conditions as I don't have another control that becomes true/false when the panel is unhidden.

 

 

or(contains(BProjectCategory,"Core Research Project"),or(contains(BProjectCategory,"Internal Capability Funding"),or(contains(BProjectCategory,"HVM Catapult Funding")))) && isNullOrEmpty({Self})

This is now working.

 

Thanks @MegaJerk: I needed the bit in your example where you added the rule to the people picker control and 

&& isNullOrEmpty({Self})

 

0 Kudos
Reply
MegaJerk
Nintex Newbie

Re: Validation rule if panel is not hidden by another rule

Jump to solution

Awesome to hear! Glad that it worked out! 

0 Kudos
Reply