How to: Create, Test, and Debug Mobile Form Templates

With Microsoft Office InfoPath 2007 and access to a server running InfoPath Forms Services, you can create and deploy InfoPath form templates that can be filled out on a mobile device. For an overview of mobile form templates, see Designing Form Templates For Use On A Mobile Device. Following the procedures below, create a basic InfoPath form template for use on a mobile device, and test and debug it using downloadable tools that are also available with Visual Studio 2005.

Creating the Form Template

In the following procedure, create a browser-compatible form template that will populate a text box in the default view with the word Mobile. If you have already created a mobile form template, skip this section.

To Create a basic form template for browser and mobile use

  1. Create a browser-compatible form template and add a Text Box control to the default view.

  2. Click Form Options on the Tools menu.

  3. Select the Browser category, then click Update in the Include the following commands on the toolbars of the Toolbars section, and click Enable rendering on a mobile device in the Mobile Devices section.

  4. Select the Open and Save category and click the Rules button.

  5. In the Rules for Opening Forms dialog box, click the Add button.

  6. In the Rule dialog box, click the Set Condition button.

  7. In the Condition dialog box, choose The expression from the first drop-down box and replace the text in the second box with xdEnvironment:IsMobile() and click OK.

  8. In the Rule dialog box, click the Add Action button.

  9. In the Action dialog box, choose the Set a field's value action.

  10. Click the button at the end of the Field box and choose field1 and click OK.

  11. In the Value box type Mobile and click OK four times to dismiss all dialog boxes.

  12. Save and publish the form template to a server running InfoPath Forms Services. The form will have to be deployed to the server by an administrator. If you have administrator privileges, see Developing and Deploying Form Templates for InfoPath Forms Services for information about how to deploy the form

  13. Note   In step 9 you could choose Switch Views to switch to a view designed for mobile use when the form is opened in a mobile browser.

Testing and Debugging a Mobile Form

A simple way to test and debug an InfoPath browser-enabled form without using a mobile device is by using desktop emulators. Emulators for a variety of device form factors and operating systems can be found on the internet.

To test forms with Microsoft mobile device emulators, you will need the Microsoft Device Emulator Manager and ActiveSync. Visual Studio 2005 and Visual Studio 2008 install the emulators and the Device Emulator Manager. If you do not have Visual Studio, are targeting Windows Mobile 6 devices, or are running Windows Vista, download theStandalone Device Emulator 3.0, which includes the Device Emulator Manager. If you require additional localized emulator images for Windows Mobile 5.0, you can download them from the Localized Windows Mobile 5.0 Pocket PC Emulator Images page. If you require emulator images for Windows Mobile 6, you can download them from the Windows Mobile 6 Localized Emulator Images page.

ActiveSync 4.5 is a separate download and is required for Windows Mobile 2003 SE, Windows Mobile 5.0, and Windows Mobile 6.0 devices syncing with computers running Windows XP SP2 or earlier. Windows Mobile Device Center 6.1 is a separate download and is required for Windows Mobile 2003 devices and later syncing with computers running Windows Vista.

Note

You may need to reboot your computer to see the Active Sync icon (for Window XP or Windows Server 2003) or Sync Center icon (for Windows Vista) in your Windows Taskbar

To Test and debug a mobile form template

  1. Launch ActiveSync or Windows Mobile Device Center.

  2. Launch Visual Studio 2005 and click Device Emulator Manager on the Tools menu. If you do not have Visual Studio 2005, browse to the C:\Program Files\Microsoft Device Emulator\1.0\ folder and double-click Device Emulator Manager (dvcemumanager.exe).

  3. In the Device Emulator Manager, right-click on your desired emulator and choose Connect.

  4. Once connected, right-click on the emulator name in the Device Emulator Manager and select Cradle.

  5. Follow the ActiveSync prompts to create a Guest partnership.

  6. Once ActiveSync displays "Connected", launch Internet Explorer from the Start menu in the emulator

  7. Browse to your SharePoint site by adding /m/ to the end of the URL.

  8. Browse to the Form Templates folder, locate the form, and click the Display link, which will take you to a properties page.

  9. Click on the form template filename on this page to load the form in the browser.

  10. Notice that you have a form loaded in the device emulator browser window, with the word Mobile in the text box. If you do not see this, or the form fails to load, check your form template again to make sure the rule is set up correctly, then re-deploy the form to the site.

In step 7 above, you may go directly to the form by using a URL similar to the following:

http://ServerName/Sites/SiteName/_layouts/Mobile/MobileFormServer.aspx?XsnLocation=~sitecollection/FormServerTemplates/MobileForm.xsn

ServerName, SiteName, and MobileForm.xsn should be replaced with values that match your server, site, and name of your form template deployed to the site. You may also use the same URL in a desktop browser to get an idea of how the form will look in a mobile browser, but you will not be able to see an exact representation of the form on a mobile device without using an emulator or the target device.

See Also

Concepts

Designing Form Templates For Use On A Mobile Device
Previewing and Debugging Form Templates on InfoPath Forms Services