Monday, June 11, 2012

Add, delete, and switch views (pages) in a form

Referred URL

http://office.microsoft.com/en-us/infopath-help/add-delete-and-switch-views-pages-in-a-form-HA101732801.aspx

Use the following procedure to add additional views to a form.

1. Click the Page Design tab then, from the Views group, click New View.

2. Type a name for the view, and then click OK.

clip_image001

3. To open the View Properties dialog box, click the Page Design tab then, from the Views group, click Properties.

4. In the View Properties dialog box, change or specify the desired settings or options for the view, and then click OK.

clip_image002

5. In the workspace, design the view by adding layout tables and controls to it.

TIP    If you want to base the design of a new view on an existing view, open the existing view, press CTRL+A to select everything in the view and press CTRL+C to copy the selection to the Clipboard. Select the new view from the View list in theViews group on the Page Design tab, delete the pre-populated content in the view then press CTRL+V to paste the selection into the new view.

Delete a view

You cannot recover or restore a view after you delete it. If you delete the default view in a form that has only one view, InfoPath creates a new default view automatically. If you delete the default view in a form that has multiple views, InfoPath will assign default view status to the next view in the list of views shown on the Page Designtab, in the Views group, on the View list.

1. Select the view that you want to delete on the Page Design tab, in theViews group, from the View list.

2. On the Page Design tab, in the Views group, click Delete.

3. When prompted to delete the view, click Yes.

Change the default view

Each form has a default view. Users see this view when they open a form that is based on your form. If you create custom views for a form, you can choose which of the available views will be the default view for your users.

1. Select the view that you want to make the default view on the Page Design tab, in the Views group, from the View list.

2. On the Page Design tab, in the Views group, click Properties.

3. Select the Set as default view check box, and then click OK.

If a form has only one view then it is automatically designated as the default view.

Rename a view

1. Select the view that you want to rename on the Page Design tab, in theViews group, from the View list.

2. On the Page Design tab, in the Views group, click Properties.

3. On the View Properties dialog box, type the new name for the tab in theView name text box then click OK.

If you rename a view that is associated with custom code, the code may not work as expected. To fix this problem, you must find all references to the old name of the view in the code and update them with the new name of the view.

Add a button for switching views

Views are often designed to work with rules. Rules enable you to automate certain tasks in response to events or actions initiated by the person filling out the form. For example, you can insert a button on your form and create a rule that switches views when the button is clicked and, after you insert the button on your form, you can associate the rule with the button so that it switches views when a user clicks it.

More specifically, in an insurance claim form, you might create a Show Summarybutton that opens a high-level view of the claim data when clicked. In the summary view, users could then click a Show Details button to return to the more detailed view. Likewise, if you have a very long form, you could break it into multiple views and add next and back buttons or tabbed navigation to allow users to navigate through the form.

1. Insert a button in each view.

To complete the following procedure, you must have a form with two existing views.

1. Select the view that you want to add a button to on the Page Design tab, in the Views group, from the View list.

2. Place the cursor on the form where you want to insert the button.

3. On the Home tab, in the Controls group, select Button.

4. Under Control Tools, click the Properties tab in the ribbon.

5. In the Label box, type a name for the button, and then click OK.

2. Create a rule that switches views.

1. Select the button.

2. Under Control Tools, on the Properties tab, in the Rules group, clickAdd Rule.

clip_image003

3. Select When this button is clicked then select Switch Views from theActions list.

4. In the View text box, select the view to display when the button is clicked, and then click OK.

clip_image004

3. Repeat steps 1 and 2 to create additional buttons and corresponding rules for each view.

4. After you have added buttons to your views and created the necessary rules, it is recommended that you test the form to ensure that it works as expected.

1. On the Home tab, in the Form group, click Preview.

2. Click the buttons to make sure that you are able to switch between views as desired.

The view that you were working in most recently is the view that will appear in the preview window, unless a rule has been created to switch the view based on the user’s role at form load.

In read-only views, buttons are not available. For navigation in read-only views, such as the display view in a SharePoint list form, use a picture button and clear the Hide picture button in read-only views check box from the control properties dialog in the Properties tab of the ribbon.

Display a view using a form load rule

When a user opens a form, the view can be specific to that user or other criteria. For example, if you are designing a form that includes user roles and contains multiple views, it can be useful to display a view that is based on the user role that is assigned to a user. Specifically, you can use a rule to display a view when a user who is assigned to a particular user role opens a form that is based on your form.

IMPORTANT    User roles can only be used in forms designed for the InfoPath filler. To switch views based on a group membership for web enabled forms, consider creating a Form Load rule that uses the getUserMemberships method of the User Profile Web Service to determine user memberships.

This procedure assumes that you have a user role defined in your form. If you do not have at least one user role in your form, add a user role from the Data tab before you begin this procedure.

1. On the Data tab, in the Rules group, click Form Load.

2. Click New, click Action, and then in the Details for text box enter a name for the rule.

3. To have the form load a view based on a user role, click the link under theCondition section. On the first list, click User’s current role, and then select the user’s role.

clip_image005

4. Click OK.

5. Click the Add button then select Switch views.

clip_image006

6. In the Views list, click the view that you want, and then click OK.

No comments: