How to create a hidden field in InfoPath

Learn how to add a field to an InfoPath form template so that it exists in the InfoPath form but remains invisible to a user, so effectively becomes a hidden field.

ADVERTISEMENTS

An InfoPath 2010 hidden field is a field that exists in the data source of the form, but that is not displayed on any view of the form.

The advantage of using an InfoPath hidden field is that you can store data in the form and keep this data invisible to the user.

You can create an InfoPath hidden field on one of 2 ways:

  1. Drag-and-drop a text box control onto the InfoPath form template’s view. If you have not changed the default settings when you first installed InfoPath, this action will automatically add a field to the Main data source of the InfoPath form. Rename the text box control if you wish and then delete it from the view. It will still be present in the Main data source when you delete it from the view, but will be ‘hidden’ from the user.
  2. Go to the Data Source task pane, right-click the myFields (root) node, and then click Add from the context menu to add a field. The field will be present in the Main data source, but not present on any view, so effectively ‘hidden’.

A good example of a hidden field in InfoPath is when using helper fields in forms as described in Master/detail across views.

May 29, 2009 Update:
I wrote and published an article showing how to create a ‘hidden’ field in a repeating table in InfoPath. And here are two practical examples of using ‘hidden’ fields in InfoPath:

 


Related Posts

 

Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author.

InfoPath 2013 Cookbook: 121 Codeless Recipes for Beginners

InfoPath 2013 Cookbook 2: 121 Codeless Recipes for SharePoint 2013

InfoPath 2010 Cookbook: 101 Codeless Recipes for Beginners

InfoPath 2010 Cookbook 2: 101 Codeless Recipes for SharePoint 2010

InfoPath 2010 Cookbook 3: 101 Code Recipes for C# Developers

InfoPath 2010 Cookbook 4: 101 Code Recipes for VB Developers

InfoPath 2010 Cookbook 5: Integrating InfoPath with Excel and Excel Services