Solved

How to hide a field based on a dropdown

  • 15 March 2018
  • 7 replies
  • 81 views

Badge +2

Hi!

 

I have a dropdown in my form that pulls from another list, and if you choose any item other than "Headset" from the dropdown, I want another field to be hidden. So if you do choose "Headset", the other field should appear.

 

Sounds easy, right? I can't get it to work. I'm using Nintex for O365 and have no other forms in place on my form, so it's not an issue of conflicting rules.

 

I've tried using not(inArray(Item, "Headset")), as well as Item!="Headset"

 

Both rules hide the field all the time, never showing it when "Headset" is selected as the option.

 

I can't figure out what I'm doing wrong, though I'm sure it's something simple I'm overlooking. Any help would be appreciated!!

Thank you!

icon

Best answer by eharris04 15 March 2018, 21:17

View original

7 replies

Badge +17

Caite,

Great question and yes it should be working. Here is the formula you want to use and the steps to get this functional in your form.

not(contains(YourNamedControl, "Headset"))‍‍

  1. Pull in the ListLookup control and name it something meaningful
    1. In my case it was Test Lookup was used. This is required so you can reference it in the rule
    2. Make sure the rest of the control is configured to show the correct values (i.e.; Headset)
  2. For the control you want to show/hide, the rule needs to be running on that control
    1. Select the control (in my case it was Email)
    2. Rule Type - Formatting
    3. Condition - select the (fx) to build your function.
      1. Use the runtime function so that your rule evaluates a runtime value. Remember the rule must evaluate to true for it to fire or in this case "HIDE"
      2. I chose the runtime function "contains" because I wanted to check if the list lookup contains the value "headset" then Hide this control
      3. The formula for this was contains(My list lookup field, "value to check for") or contains(Test Lookup, "Headset") as you can see in the screenshot below.
      4. After testing for this and ensuring it worked, I reversed this by adding the not() condition. So when Test Lookup does not contain "headset" then hide the control, Email.

I hit preview and it worked... Hope that helps 

Badge +1

Thank you, this work brilliantly for my radio button lookup as well. 

Badge +10

I simply used a form variable for that:

1.

2.

In my case the element is hidden when "Puma" is selected.

Cheers

mai-kel

Badge +11

It may help if you put the lookup control name inside a parseLookup() function which will strip out the lookup control's #mark and ID No from the lookup list. Then your comparisons functions should start to work:

e.g.

not(contains(parseLookup(LookupControlName), 'Headset'))

or

not(equals(parseLookup(LookupControlName), 'Headset'))

Badge +2

I have used the not(contains(namedcontrol, 'Support Worker'))  but to no avail. Can this be used on a control within a repeating field.

 

I have 4 potential contact lists to come into view based on a person's role/title selection in the field above. So on each of the contact lists I am setting the above rule. 

 

e.g. on the SW contacts choice control that I want to appear based on 'Support Worker'  role selection, I am adding the following; not(contains(contacts_role, 'Support Worker')) , then Hide.

 

I have followed this through for each list and each role but when I preview, all the lists are there all the time without even making a selection in the role field.

 

I am confused because I have used this same rule on other controls and it worked. 

 

Kaz :-)

@eharris04


When I use the formula on my panel that you demonstrated and preview my form the panel is hidden. However, when I select the choice that I want the panel to display nothing is happening.
My setup:
Choice field - Type of RFI: RFI


                                           OSINT RFI
Multiple lines of text field (should be hidden unless OSINT RFI is selected).
Rule Formula applied to the panel that contains the text field: not(contains(Type of RFI, "OSINT RFI"))
This is set as a required field and does not have a choice default selected in order to force the user to make a specific option.
Am I missing something that would cause my text field to not display when OSINT RFI is selected?
Thank you.

You need to make sure you select the field you want from the "Named Controls" drop down and not the "Item Properties" Drop down. Selecting a field form the Item Properties list will give you the exact results you are seeing.

Reply