Tuesday, August 08, 2006

Hiding check boxes and DateTime controls

InfoPath still does not allowing hided checkboxes and DateTime controls.
In certain situations it’s recommended to hide those controls for the users.
The conditional formatting options are restricted and we can only disable them.

Use following trick to hide controls:

1. Create an empty group (for example: CheckTest) in the main datasource.
This group will act like a wrapper section for the Checkbox (which can not be invisible)

-> CheckTest

2. Add a Boolean field into 'CheckTest'
If you don't want to hide FieldA, you can add this field directly below my:myFields.

-> CheckTest
-> FieldA

3. Use ‘CheckTest’ as Section on the screen.

4. Use conditional formatting to hide this section when the user may not see the check boxes.
Perhaps you need another field to base your conditional formatting on.
For example: if FieldB is empty then 'Hide'.

Tip: You can base your conditional rule on another field which is calculated by customized code or directly based on existing fields or expressions in your form.

For a detailed example please read Greg Collins' article on InfoPathdev.com