Friday 19 June 2009

How to use Cascading Dropdown List Boxes within an InfoPath Web Form

Introduction

To create user‐friendly web forms, cascading dropdown list boxes is a must, but InfoPath Form Services doesn’t allow you to use them, like you can use them with InfoPath Client.

HOW TO use Cascading Dropdown List Boxes within an InfoPath Web Form.docx

Design the InfoPath Form

1. Create the data connections to the different data.

2. Note:
Be sure the Data Connection is not retrieving the data automatically for the Cascading Dropdown list box. The data connection used for the Main Dropdown list box must be set to Automatically retrieve data when form is opened

3. Add the Dropdown list boxes to your form + link the Data Connection to it

4. Open the properties dialog box of the main dropdown list box

5. Select Browser Forms Tab

6. Select Always



Figure 1. Browser forms options of the Main Drop Down List box

Note:
The next step will open Visual Studio Tools for Applications, be sure to have set the Form Template Code Language to C#, (Menu Tools ‐ > Form Options ‐> Programming

7. Right‐Click the Main Drop down list box, select Programming ‐> Changed Event…

8. Add the following code to the newly created Change event function


9. Add a private function to the FormCode

10.In the Change event function, change the strings to their corresponding values

Publishing the form

When using Managed Code with a InfoPath Web Forms a SharePoint Administrator must validate the form first

1. Use the normal way of publishing, the difference will be that a XSN file will be saved locally.

2. Open the SharePoint Administration Central

3. Go to Application Management

4. Click on Manage Form Templates

5. Click on Upload Form Template

6. Select the XSN, created by the publishing tool in point 1

7. Click on the Upload button

8. Back in the Manage Form Templates Screen, click on the Form Template and select Activate to a Site Collection

9. Change the Site Collection if needed

10. the Ok Button

11. Go to the Forms Library and select the settings

12. Go to Advanced Settings

13. Set Allow management of content types to YES

14. Select Display as webpage

15. Save the new settings

16. Back in the Settings Screen, Click on Add from existing content types link in the Content Type section

17. Select your Form and click the Add button

18. Test your form

Conclusion
This way of working will let us use Cascading Dropdown boxes

No comments:

Post a Comment