This article explains how to use Rules to hide fields based on a value in a field on the form (e.g. based on a dropdown value) or based on form properties (e.g. hiding a field in edit mode).
**If you want to hide fields based on the current users membership in a group please go to the Hide fields based on Group Membership tutorial as you can’t use Rules to check group membership.
Using Rules to hide a field or fields
Any field or fields you want to hide on a form should be placed in a panel. This will ensure both the field(s) and it’s label(s) are both hidden, and that there are no blank spots on the form where the fields used to be. In this tutorial we are going to hide the Status field when people are submitting new forms (but have it visible when editing or viewing a form) and only making the Urgent Justification field visible if someone selects Urgent from the Priority field.
1. Go to the list and open up Nintex Forms. The first thing we are going to do is make the form wider and longer so we have room to add panels to the form. Click on the Nintex Forms tab, click on Settings.
2. On the Settings menu, add 500 to the Canvas height and add 50 to the Canvas width.
3. So in this example the height went from 400 to 900 and the width went from 700 to 750. When you are done, click on the Save button.
4. Select the field you want to hide and all the fields below it, so the Status field and all the fields below it in this example. Tip: Click in the gray area to the left of the fields and drag across and down the form to select all the desired fields at one time.
5. When the fields are selected, drag the selected fields to the bottom of the form.
6. You should now have a blank area in your form above the field you want to hide.
7. Find the Panel form control, drag it onto your form into the blank area.
8. Resize the panel so it fits into the blank area. Make the panel wider than your fields, this will make the panel easy to select and view later on.
9. Select the field you want to hide and it’s label (again click and drag across and down)
10. Drag the highlighted field and it’s label into the panel. Make sure the panel is highlighted in blue which signifies you are placing the field and the label into the panel. There will be a little gap between the top of the panel and the top of your field, this is ok.
11. Resize the Panel so it’s about the same height as the label and field, there should be a small gap both above and below the field to ensure the entire field is inside the panel.
12. Highlight and select all the fields below the panel and drag them up beneath the panel. Again make sure there is a small gap beneath the panel. If you overlap the panel with the field or label below, that will cause a large gap when the field is hidden.
13. As a check, click on the right-hand side of the panel. This should highlight the panel, and any fields and labels that are inside the panel.
14. Now we are going to add a rule to the panel to hide it.
A. Click on the panel, that should highlight both the panel and any fields inside the panel.
B. Click on the Add Rule icon
15. Enter a descriptive Name for the Rule, then click on the Insert Formula icon.
16. For this rule we are going to hide the panel with the Status field in it for new form submissions, but still have it visible when editing or viewing the form.
A. Click on the Common tab
B. Click on the Is New Mode condition, the reference to the condition should appear down below in the Formula box.
C. Click on the OK button to save the formula
**For additional Formula examples, see the Nintex Forms Rule Formula Examples tutorial.
17. Click the Hide checkbox on the rule window. Your finished rule should look something like this.
Optional: Hide additional fields on the form
For this example, we are also going to hide the Urgent Justification field unless the Priority equals Urgent.
I. Repeat steps 4 – 13 to put the additional field(s) in another panel. Once the panel has been created, populated, and the fields all organized.
A. Click on the panel so it’s highlighted
B. Click on the Add Rule button.
II. Enter a descriptive Name for the Rule, then click on the Insert Formula icon. Both of my form rules are displayed since I clicked the ‘Show All’ checkbox under the rule box.
III. For this example we are going to create a rule that hides the Urgent Justification panel unless Priority equals Urgent. We are not going to hide the panel when Priority equals Standard since then the panel would still be shown when the priority field was blank.
A. Click on the Named Controls tab to see the fields in the form.
B. Double click on the field you want to reference, Priority in this case.
C. In the Formula section, the red Priority field reference should appear.
IV. After the Priority field reference, type: !=’Urgent’. Click Ok to save the formula.
The exclamation mark in front of the equals sign means not equals, and then put the value of the field inside of single quotes. So what this rule means, is Priority Not Equals Urgent.
**For additional Formula examples, see the Nintex Forms Rule Formula Examples tutorial
V. Click the Hide checkbox on the rule window. Your finished rule should look something like this.
Preview your form to make sure your rules are working
After you have all your fields you want to hide into panels, and have added rules to the panels. You need to preview your form to make sure they work.
18. Bring up the preview panel and make sure you choose the correct Mode.
A. Click on the Nintex Forms tab
B. Click on the Preview icon
C. Choose the Mode of the form you want to preview, in this case New mode.
D. Click on the Generate Preview button.
Finished Preview: Both the Status and Urgent Justification field are hidden on New form load.