Designing InfoPath 2007 Forms for Mobile Web Browsers
Summary: Learn how to create a mobile-friendly view of a Microsoft Office InfoPath 2007 form template, add managed code to detect the user's environment and switch views accordingly, and then publish the form template to InfoPath Forms Services.
Applies to: 2007 Microsoft Office System, Microsoft Office InfoPath 2007
David Gerhardt, 3Sharp
The 2007 Microsoft Office system provides support for running Microsoft Office InfoPath 2007 forms in a mobile Web browser. This addition to the Office InfoPath 2007 feature set opens up a broad range of user scenarios.
There are limitations to the behavior of mobile Web browser forms. For example, formatting and layout in views are ignored, the date picker is rendered as a text box, and controls such as the rich text box, option button, section, and repeating table are not supported. Still, the effort required to render existing form templates on a mobile device is minimal.
For this scenario, you use the status report sample that is included with InfoPath 2007, create a mobile-friendly view, add a few lines of managed code to detect the current user's environment and switch views accordingly, and then publish the form template to InfoPath Forms Services.
Enabling Rendering on a Mobile Device
Start the status report sample template in the InfoPath designer, and enable mobile Web browser support.
To enable rendering on a mobile device
Creating a Mobile-Friendly View
The default form view for the status report template contains some controls that are not supported in mobile Web browsers. As a result, you will create a mobile-friendly view.
To create a mobile-friendly view
Figure 1. Creating the mobile Web view
By default, view names appear on the InfoPath View menu and as list options in a mobile Web browser. Follow these steps to remove the view options from these lists.
To remove view options
If you have not already done so, save the form template locally before you add any code.
Adding a Loading Event
To add managed code to your form solutions, you can use Visual Studio 2005 Tools for the 2007 Microsoft Office System (VSTO 2005 SE) or Visual Studio 2005 Tools for Applications (VSTA). Office InfoPath 2007 includes VSTA, which you use in this scenario to add a Loading event that switches to the Mobile Web view if the current user starts the form in a mobile environment.
You can set the programming language to Visual Basic or C# before you add managed code to your form template. To make this change, on the Tools menu, click Form Options, click the Programming category, and set the Form template code language list value accordingly.
To add a Loading event
Deploying the Form Template
Because the form template is enabled for mobile Web browsers, it must be admin-deployed, with or without managed code. In other words, you must first publish the form template to a network share.
To publish the form template
After the form template is published to a network share, a server administrator can upload that form template to InfoPath Forms Services and activate it to a specific Windows SharePoint Services 3.0 site collection.
To upload the form template to InfoPath Forms Services
Starting the Status Report Form in a Mobile Device
To test your changes, you will need to start a browser session either on a mobile device or an emulator, such as Microsoft DeviceEmulator 2.0.
In Internet Explorer, navigate to the browser location of your form template, which will be the following:
Figure 2. Viewing the form on a mobile device
Note how the Mobile Web view is displayed in the browser, as shown in Figure 2.
There is support for rendering Office InfoPath 2007 forms in mobile Web browsers, but there are limitations to the form behavior. Fortunately, you can easily work around those limitations when you are developing a mobile form solution:
Video Length: 00:09:41
File Size: 7.44 MB WMV