Now you might wonder why you would always hide a form field. There are two major use cases:
- Holding intermediary calculations: If the control has a "Calculated Value" and/or "Initial Value" formula, it can be referred to by variable name (like $my-intermediary-result) from other formulas.
- Handling out-of-band validations: If the control has a label, alert and validations, a failing validation will show in the Error Summary. In addition, this also impacts the Wizard View's lax and strict validation modes, preventing forward navigation until the error is fixed by the user.
As a workaround, you can place a CSS class to hide a Calculated Value control to the user. The drawback of this is that the value of the control is still visible in the browser using "View Source" or development tools so this workaround cannot be used for sensitive data which the user should never see.
The new Hidden Field control, on the other hand, works like a regular control such as a Text Field in all respects, including events, validation, and alerts. Except, of course, that it doesn't show to the user at runtime. In particular, its value is guaranteed to stay on the server.
At design-time, in Form Builder, the control shows as a box with an icon so that the form author knows that a hidden control is in use. You can move that control and modify its properties like with any other form control.
|Hidden Field in Form Builder|