Partilhar via


InfoPath: Adding a button to switch between views

The ability to have multiple views of information and multiple uses for forms is one of the great features of InfoPath. And yet, any person responsible for supporting the users working with the forms can tell you that it can be a real challenge to users to have to switch views via the menu system. However, it's remarkably easy, once you know how, to add a button to your form that allows your users to quickly switch between views. The button will use a rule with the Action of Switch Views -- it's a simple as that.

This will be a learn by doing exercise, so launch InfoPath. Really, it will only take a few minutes, and I'll wait :) Open the sample form called "Meeting Agenda". This form has two views, one for the Agenda and one for the Meeting Minutes. (It's also a very handy sample with very little modification, in my opinion.) We'll add a button to each view at the top of the form that allows the user to easily switch between the views.

Place your cursor in the space to the right of the words "Meeting Agenda". In the Design Tasks Pane, choose Layout. Under Merge and split cells, click on Split Table Cells Vertically. This will add another table cell in the title row. In the Task Pane click on Controls and drag the Button control into the new cell you just created.

Now we'll assign a label to the button and set up a Rule that switches views when the button is clicked. Double click on the Button control you just inserted. Change the label on the button to "Minutes View". Click the Rules button in the properties, and add a new rule. (The name of the rule doesn't matter at this point.) Click on Add action and choose Switch Views. Chose the Minutes View (post meeting) as the view to switch to. There's no need to set a condition, since we want this action to occur when the button is clicked. OK through the dialogs to complete the process.

One view down, one to go. Use the View menu in the Task Pane to switch to the Minutes View (post meeting) , and repeat the process, this time labeling the button "Agenda View" and switching to the Agenda View (pre meeting) . Test and save the form and voilà, your users now have an easy way to switch between views!

Bonus: Publish the form to your SharePoint site and you have a really handy tool for your teams to use to plan and track the results of meetings!