Hide or disable fields based on multiple conditions

  • 19 September 2016
  • 5 replies
  • 58 views

Badge +3

This post applies to Nintex Forms. Business requirements are for a Form to allow new submissions by anyone, but editing the Form will only be available to a Manager's group.

From my understanding, there are two ways to Hide or Disable fields.

1) Under Control Settings for each control, I can modify the Appearance settings using Expressions for Visible or Enabled. This does have an Inline Function called (fn-IsMemberOfGroup() that is exactly what I need and it works by itself. It also has options for "Is Display Mode", "Is Edit Mode" and "Is New Mode".  These conditions also work by themselves. When I try to put two or more of these conditions together is where it fails.

Here is my Expression: (fn-IsMemberOfGroup("IT Managers")) || (Is New Mode) . If the person is a member of the IT Managers group or the Form is a New form, then Enable the field. What happens is that no conditions are processed and the field shows everywhere under any condition.

2) From reading many posts on this, Rules might be the better way to do this. Except that I do not see any functions in Formatting Rules that would allow for validating Group Access. 

My questions are:

Can I make the Expression under Control Settings work with multiple conditions? Maybe my syntax or logic is wrong.  

Is there a way to use Rules to validate Group Access and hide or show fields based on that?

Here is a (long) post that I have used for reference, but does not cover my particular questions. How do you hide a form control based on two different conditions? 

Thanks for reading, and any advice would be appreciated.


5 replies

Userlevel 5
Badge +14

1) => that should work, you just need to use fn-Or() inline function instead of || operator

2) => that should be doable as well: place a single line text control on the form and set its default value to fn-IsMemberOfGroup("IT Managers"). then in rule check value of that control

Badge +3

Brilliant! Thank you for the help. This was really easy to implement once I got the correct syntax, and I'll mark this as the correct answer. 

#1 works flawlessly using the fn-Or() inline function. 

#2 Does work partly. The problem with setting the default value for the new field, is it never resets for different users.

If a regular user fills out a new form, that new field "GroupCheck" is marked as False. When the next person comes along, that field is still marked False, regardless of whether they're in the group or not. I would prefer to use method #2 as it will be easier to maintain the form. Do you have any other ideas to store that value? Is there a way to force it to rewrite the field each time the form loads? or something else?

Thanks again! You my have saved me a lot of time.

Badge +3

For #2, I found that you can actually use the function fn-IsMemberOfGroup() in the Rule directly, even though it is not an option to choose from. Just copy and paste it into the Rule and it will work and filter out people who are/aren't in the group. No need to use the text box to store the value.

Userlevel 5
Badge +14

great you learn it on your own!

I was just about searching for my following former post where I recommended the same. it just took me some time to compile correct search phrase...

https://community.nintex.com/message/36494?commentID=36494#comment-36494 

Badge

Did you new code look like this?

(fn-IsMemberOfGroup("TDM Owners")) or(Is Edit Mode

Reply