In this article
Introduction to InfoPath-only views
You can design one form template that accommodates two types of users — those who have Microsoft Office InfoPath installed, and those who do not. This type of form template is called a browser-compatible form template. In a browser-compatible form template, any InfoPath features, settings, and controls that won't work in a Web browser are hidden or disabled in design mode. That way, you aren't tempted to use them in your design.
When you're ready to share a browser-compatible form template with users, you must publish it to a server running InfoPath Forms Services, and then make it browser-enabled. If users have InfoPath installed on their computer, then the form will open in InfoPath. If they do not have InfoPath installed, then the form will open in a Web browser. Either way, the form template doesn't include InfoPath features, settings, or controls that won't work in a browser.
If you expect that many of your users will have InfoPath installed on their computers, you may not want to limit the design of your form template to the subset of features that are supported in a Web browser. In this case, you can create two views of your browser-compatible form template. One view will be for users who open the form template in a Web browser. The other view will be used exclusively by users who have InfoPath installed on their computers. This InfoPath-only view will never display in a Web browser. Consequently, you can use InfoPath features in this view that you wouldn't otherwise be able to use, such as user roles or master/detail controls.
In this topic, you will learn how to design a dedicated InfoPath-only view in a browser-compatible form template. In addition, you will learn how to create a rule that detects whether the user opening the form template has InfoPath installed on their computer. If InfoPath is detected, the user will see the InfoPath-specific view. If InfoPath is not detected, the user will see the browser-specific view in a Web browser instead.
Scenarios for use
Imagine that you work for an insurance company, and that you are designing a browser-compatible form template for processing insurance claims. Your browser-compatible form template must accommodate policyholders who open and fill out the claim form from your company's Web site, as well as internal users who review and approve the data in the claim form. Your expectation is that external users do not have InfoPath installed on their computers and that internal users do have InfoPath. To accommodate users who do and do not have InfoPath installed, you could design two distinct form templates — one that is browser-compatible and one that is not. However, it is easier and more time-efficient to design one browser-compatible form template that includes the following views:
View 1: External, claim-filing view This is the view that policyholders see when they log in to your Web site and open a claim form. Because there is no way for you to know whether a policyholder has a copy of InfoPath installed on his or her computer, the form template must be browser-compatible. That is, you must ensure that the form can be filled out by using a Web browser.
View 2: Internal, claim-processing view This view is for claims processors, who review the submitted claim form and route it to an insurance adjuster for approval. All insurance company employees have InfoPath installed on their computers. Therefore, you can design a dedicated InfoPath-only view for them. Unlike the claim-filing view, which is accessed by policyholders using a Web browser, the InfoPath-specific view never displays anywhere but in InfoPath, and may therefore contain any of the features, controls, and settings that are not available in browser-compatible form template.
Step 1: Add an InfoPath-only view to a browser-compatible form template
To create an InfoPath-only view in a browser-compatible form template, you change a setting in the View Properties dialog box. This setting allows InfoPath users to see the view, but prevents the view from displaying in a Web browser.
-
Open your browser-compatible form template.
-
On the View menu, click Manage Views.
-
Under Actions, in the Views task pane, click Add a New View.
-
In the Add View dialog box, type a name for the view, and then click OK.
-
In the Select a view list, double-click the view that you just created.
-
Click the General tab.
-
Clear the Show on the View menu when filling out the form check box.
Note: Clearing this check box prevents users who do not have InfoPath installed from attempting to switch to the InfoPath-only view.
-
Select the Allow InfoPath-only features (the view will not be available in Web browsers) check box, and then click OK.
-
Design your view as you normally would.
You are now able to use many of the features, controls, and settings in your InfoPath-only view that would not otherwise be available in a browser-compatible form template. For example, you are free to use any of the controls in the Controls task pane, as opposed to just the ones that work in a browser. In addition, you will not see any browser-compatibility errors or messages in the Design Checker task pane.
Note: Although you can use the majority of InfoPath features in your InfoPath-only view, certain features and settings that apply to the browser-compatible form template as a whole remain disabled or hidden. For example, you cannot enable digital signatures for the entire form template or use script in your view, since one of the views of your form template is browser-compatible.
-
To add additional InfoPath-only views to your browser-compatible form template, repeat steps 2-9.
Step 2: Display the browser-only view when the browser-enabled form template is opened in a Web browser
In this procedure, you'll learn how to create a rule that dictates the view that the user sees when they first open a form based on your browser-compatible form template. The rule runs when the form is first opened, and after a particular condition is met. The condition in this case has to do with whether users are opening the browser-enabled form template in a Web browser. If they are, then the browser-only view of the form template appears. This view is limited to the set of features that are supported in a browser.
-
Open your browser-compatible form template containing the InfoPath-only view.
-
On the Tools menu, click Form Options.
-
In the Category list, click Open and Save.
-
Under Open behavior, click Rules.
-
In the Rules for Opening Forms dialog box, click Add.
-
In the Rule dialog box, type a meaningful name for your rule, such as Rule 1: Switch to Browser View.
-
To specify when the rule should run, click Set Condition.
-
In the first box under Apply the rule when this condition is true, click The expression.
-
In the second box, type xdEnvironment:IsBrowser(), and then click OK.
-
In the Rule dialog box, click Add Action.
-
In the Action list, click Switch views.
-
In the View list, click the browser view that you want to switch to, and then click OK.
-
To prevent any rules from running after this rule (for the current event), select the Stop processing rules when this rule finishes check box in the Rule dialog box.
The rule that you just created will run when the form template is opened and the condition you specified — that is, that the user's environment is a Web browser — is met.
Step 3: Display the InfoPath-only view when the browser-enabled form template is opened in InfoPath
Now you will add another rule to your browser-compatible form template. This rule runs when the form is first opened, and after a particular condition is met. The condition in this case has to do with whether the user who is opening the browser-enabled form template has InfoPath installed on his or her computer. If Infopath is installed, then the InfoPath-only view of the form template displays. Because this view is only visible from within InfoPath, it can contain the full range of InfoPath features.
-
Open your browser-compatible form template containing the InfoPath-only view.
-
On the Tools menu, click Form Options.
-
In the Category list, click Open and Save.
-
Under Open behavior, click Rules.
-
Click Add.
-
In the Rule dialog box, type a meaningful name for your rule, such as Rule 1: Switch to InfoPath View
-
To specify when the rule should run, click Set Condition.
-
In the first box under Apply the rule when this condition is true, click The expression.
-
In the second box, type not(xdEnvironment:IsBrowser()).
-
Click And.
-
In the first box under the first condition, click The expression.
-
In the second box, type not(xdEnvironment:IsMobile()), and then click OK.
-
In the Rule dialog box, click Add Action.
-
In the Action list, in the Action dialog box, click Switch views.
-
In the View list, click the InfoPath-only view that you want to switch to, and then click OK.
-
To prevent any rules from running after this rule (for the current event), select the Stop processing rules when this rule finishes check box in the Rule dialog box.
The rule that you just created will run when the form template is opened and the condition you specified — that is, that the user's environment is InfoPath and not a Web browser or a mobile device — is met.
No comments:
Post a Comment