Collapsible Sections
Collapsible Sections
Mark asks:
How do I create a collapsible section? That is, a section that can show/hide child controls, whether they are required or not. I can't use an optional section, because it requires binding.
The easiest way to do this is to this is using Conditional Formatting. Select the Section control, then pick Format | Conditional Formatting.... Add a rule where the formatting is “Hide this control”.
We often call this “conditional visibility.” Like everything in InfoPath, the view state is driven entirely by the data, so you need something in your data which maps to the expand/collapse state. One common approach is to add an attribute field to the group element the section is bound to. It shows up in your data when saved, and the expand/collapse state is saved when users save the form.
Bind a checkbox to the attribute, and you now have UI which lets the user control the state. If you prefer a button, you can create a rule which sets the value of the attribute; use two buttons with more conditional visibility rules to swap the label (e.g. between a + and a – to look like a TreeView). You can also write code which modifies the value of the attribute, and the section will show or hide.
Comments
Anonymous
June 01, 2004
Thanks! I'll give it a try and post my experiences...Anonymous
June 01, 2004
Works like a dream...thanks!Anonymous
June 23, 2004
it is great work. Preferably we can use an arrow.gif in the horizontal direction and once the section get expanded we can place the GIF pointing down. User will click on the GIF to expand or collapse the sections.Anonymous
April 28, 2008
PingBack from http://sharenotes.wordpress.com/2008/04/28/infopath-forms-minimize-andmaximize-sections-or-collapsible-sections/Anonymous
September 15, 2011
In InfoPath 2010 against an existing SharePoint list, it appears I cannot add additional sections where normally in 2007 I would do exactly as you describe. I can pput more than one on the form, but the advanced view only shows one _RW section and I cannot then hide one from a form element in another.Anonymous
October 03, 2011
Can I have a table in a collapsible Section? I've tried it, and it doesn't like me putting a table inside a section. I need this for proper formatting. Thanks.