Wednesday, September 5, 2012

Hidden Fields in InfoPath


I want to be able to control if a textbox is displayed or not based on the value that's chosen from a drop down menu. Let’s say, my dropdown has 3 values Success, Partial Success & Failed

I want to hide the textbox – Comments, if the value is Success and display it if any of the other two values are selected.

1.      Open the form in InfoPath Designer. Select the control you want to hide under certain conditions (in this case, your Comments field).

2.      With the control selected, click the Manage Rules button in the Control Tools / Properties ribbon.

3.       When you click that button, the Rules pane will open on the right side of your screen. (Depending on your monitor and resolution, you may have to scroll to the right to see it).

4.      In the Rules pane, click the New button and select Formatting.

5.      This will activate the lower portion of the pane. InfoPath will give it the name of “Rule 1” by default, but you should give it a descriptive name, such as “Hide Comments” or “Hide Comments based on Result.”

6.      Under the Condition heading it will say “None.” Click the word None.

7.      This will open a dialog box called Condition which is where you set your rules. You want to use the fields to build the statement: “When Result is equal to Success”
– Field 1: Result
– Field 2: is equal to
– Field 3: Type text … ; then type in Success
Click OK

8.      The dialog box will close. In the Rules pane, check the box next to “Hide this control.”

9.      Save the form, then use Preview to check that the formatting works the way you want it to before Publishing.

Here’s a bonus tip: Rules and conditional formatting do not work with field labels. In this case, I might delete the text label for Comments, and add some default text in the control properties, such as “Comments” or “Type your comments here” or something similar as a prompt to label the field within the field itself.

No comments:

Post a Comment