Hide-Show Section Template Part - Mel Balsamo

InfoPath Dev

This Blog


Mel Balsamo

Hide-Show Section Template Part

I'm sure by now you already have an idea of what template parts are. There have been numerous posts and blog posts describing what template parts can do and how you can use them to make designing your InfoPath forms easier and less time-consuming.

Speaking of saving time designing forms, wouldn't it be nice to just have a place where you can grab template parts and use them on your forms right away, rather than creating them from scratch? I did a search and found only a few pre-made ones. So I think it would be really good to start compiling these template parts and make them available for everyone to use and just customize as needed.

Let me show you one good example of a template part that can't be found anywhere. (Believe me, I searched everywhere!) This template part allows you to show or hide sections in your form. It is often useful in forms that have Help sections or those that have a bunch of details that make the form look crowded and untidy.

This is the Qdabra Hide-Show Section Template Part, which is part of the Qdabra Template Parts package ($25). See all of the template parts included in this package and purchase it here.

This is what the template part looks like when the section is hidden.  


If you wish to expand the section and see the contents, just click on the Show Details link or the down arrow key. 


For you to be able to use it in your forms, you must first install the template part in InfoPath. Here are the steps to do that:

1.       In InfoPath Design mode, click Controls in the task pane, and scroll down to the Custom section found at the very bottom of the task pane.

2.       If you haven’t installed any custom controls (like template parts), you will see that the Custom section is empty. Click Add or Remove Custom Controls, and then click Add in the dialog box that appears.

Figure 3

3.       In the Add Custom Control Wizard, select Template Part from the options and click Next.

4.       Browse to the path of your template part, and click Finish then Close when done.

5.       The template part will now show in the list of your installed template parts. Click OK to close the dialog box.

Figure 4

6.       After successful installation, the template part will now be available in the Custom section of the Controls task pane.  

Figure 5

To use it in your form, just click the template part and it will be shown on InfoPath’s design area (Figure 6). You can then continue designing your form and edit the sections in the template part as necessary.


Below are the screenshots of the form I have designed using the Hide-Show template part.

All sections hidden:


Showing one of the section’s details:


All sections’ details shown:


Additional Info:

If you have added a template part to InfoPath as a custom control, modifying the template part will not change the control. You have to uninstall the current version from your custom controls in InfoPath (using Add or Remove Custom Controls) and then add your new version. To do this using the Hide-Show template part, change the placeholder texts so that it can be used specifically for How-to tutorials. 


Save the template part to the same location it was in when we originally added it as a custom control. Remove the template part from your custom controls in InfoPath (leaving the original control on your form) and add the modified template part to your custom controls. Then, on the same form we created on Step 6, add the template part below the custom control we already had. In Figure 11, the first template part was from the original control, the second after we removed it and re-added it.

Figure 11

You can’t simply add the control (template part) again – you will get an error message that it already exists. It has to be removed and re-added.After re-adding the control, you can update the existing template parts that are present on your form by right clicking the old template part and selecting Update. 


You will see that the template part in the form has been updated. 

Figure 13

In a real working environment, you must send the updated template part to anyone who is using the original. After the updated template part is installed on each computer, the users are notified that an update is available, thus the need to update the existing forms that are using the template part.



Mel Balsamo said:

We know that the main advantage of using InfoPath template parts (XTPs) is that it helps us design our

July 18, 2009 8:24 PM
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.