Pages

Showing posts with label Infopath 2010. Show all posts
Showing posts with label Infopath 2010. Show all posts

Thursday, August 13, 2009

An Introduction to Infopath 2010 - Part-3 - Creating Cascading Dropdowns

In continuation to my previous posts

An Introduction to Infopath 2010 - Part-1 - An Overview

An Introduction to Infopath 2010 - Part-2 - Creating Basic Forms

In this post we will see how easily we can create Cascading Dropdown controls in Infopath 2010 Desinger tool.

Most of the times in our applications Cascading Dropdown (When there is change event for one of the combo box should reflect the values in another combo box. For example when we change the Country in the country Combobox, then the states should reflect in the State Combobox for the selected country) is a common requirement. Right now in SharePoint we are achieving this requirement by using JavaScript or a JQuery.

Infopath 2010 made our job more easy by providing this functionality out-of-the-box. Now we will see a sample for creating a form to demonstrate the Cascading Dropdown functionality.

Step-1: Creating a Sample Form

Create a sample form as shown in the following picture with two dropdown list controls for Country and State.



Step-2: Creating an XML file

For this example we are considering xml as a data source. Following is the xml format for storing the Country and State data:

<?xml version="1.0" encoding="UTF-8"?>
<root>
<country displaytext="India" displayvalue="India">
     <state displaytext="Karnataka" displayvalue="Karnataka"/>
     <state displaytext="Andhra" displayvalue="AP"/>
     <state displaytext="Maharastra" displayvalue="Mumbai"/>
</country>
<country displaytext="US" displayvalue="US">
     <state displaytext="Alabama" displayvalue="1"/>
     <state displaytext="Alaska" displayvalue="2"/>
     <state displaytext="Arizona" displayvalue="3"/>
     <state displaytext="Arkansas" displayvalue="4"/>
     <state displaytext="California" displayvalue="5"/>
     <state displaytext="Colorado" displayvalue="6"/>
     <state displaytext="Connecticut" displayvalue="7"/>
     <state displaytext="Delaware" displayvalue="8"/>
     <state displaytext="Dist Columbia" displayvalue="9"/>
     <state displaytext="Florida" displayvalue="10"/>
     <state displaytext="Georgia" displayvalue="11"/>
     <state displaytext="Hawaii" displayvalue="12"/>
     <state displaytext="Idaho" displayvalue="13"/>
</country>
<country displaytext="China" displayvalue="China">
     <state displaytext="Anhui" displayvalue="1"/>
     <state displaytext="Beijing" displayvalue="2"/>
     <state displaytext="Fujian" displayvalue="3"/>
     <state displaytext="Gansu" displayvalue="4"/>
</country>
</root>

Save this xml content in a file and name the file as "Country_State_List.xml"

Step-3: Adding XML as Resource File to Infopath form

Now we will add the file what we created in the Step-2 as a resource file to Infopath form. To add a resource file, Select Data -> Resourse Files as shown in the picture:



Step-4: Creating Data Source

Now we will create a new data source, in our case data source is an xml file which is available as a resource file. To add a data source, Select Data -> From Other Source -> From XML file. While selecting XML file, we have to select it from the Resource Files. Following picture shows the steps to follow:



After this step, a data connection with the name is available in the form as shown below. This is just a verify the data connection.



If the new data connection is not available as show in the picture, please follow the above steps again.

Step-5: Mapping Data Source to Field Controls

Final step is to map the data source to the corresponding combobox (Country and State).

Map the Country Combobox as shown in the following image:



Similarly Map the State Combobox as shown in the following image:



Finally we have to add the filter for the State Combobox to display only the States Associated to the select Country in the Country Combobox. Following image shows how to add the filter (with a black circle on the field):



yup, we are done with the cascading dropdowns setup with a xml datasource. Now we can preview the form by selecting Home -> Preview tab. Following image shows the preview of the same:



Please note that we can use same sample for any other data source like MS-Access, SQL Server or Web Service.

Wednesday, August 12, 2009

An Introduction to Infopath 2010 - Part-2

In continuation to the previous post - An Introduction to Infopath 2010 - Part-1, this post explains on how we can create/design a basic forms using InfoPath 2010.

To design an InfoPath form we will be using InfoPath Designer 2010.



Designer comes with a set of predefined templates for easy-to designing the forms. All these templates are grouped into different buckets like Popular Form Templates, Advanced Form Templates, InfoPath 2007 Form Templates, Template Parts.

Following screen shot shows the set of templates available in the designer:



This window in the office terms is called as Office Out Space, which allows us to open an existing forms, close the form or even to print a form. All the office 2010 applications contains Out Space to perform these operations with an additional tab for setting the options within that application (which can be Infopath/Excel/Word/PowerPoint etc).

Following table provides the set of templates available with the designer with the brief description about their usage:

Popular Form Templates

  • SharePoint List

  • Template used to view and edit items in the existing SharePoint List.
  • SharePoint Document Library

  • Template to collect and save the data in a SharePoint Document Library.
  • Blank

  • A Blank template for designing the form. It can be used for the browser enabled forms.
  • E-mail

  • Teamplate for designing the email submitted forms.
  • Blank (InfoPath Editor)

  • A Blank template for designing the form and it can be used only with the InfoPath editor while submiting the form.

    Advanced Form Templates

  • Database

  • Template to design a form to collect data from databases like MS-Access, SQL Server.
  • Web Service

  • Template to design a form for query data from a Web Service and even to submit to a Web Service.
  • XML or Schema

  • Template to design a form based on an xml file or an a schema file.
  • Data Connection File

  • Template to design a form to query a SharePoint Data Source which is defined in a Data Connection File.
  • Convert Word or Excel Form

  • Template to design a form based on Microsoft Word document or Microsoft Excel.
  • Document Information Panel

  • Form used to edit the properties of the documents stored in a Document Library.

    InfoPath 2007 Form Templates
    These templates are for the InfoPath 2007.
  • Blank

  • A Blank template for designing the form. It can be used for the browser enabled forms.
  • Blank (InfoPath Editor)

  • A Blank template for designing the form and it can be used only with the InfoPath editor while submiting the form.

    Template Parts
    These templates are used to design a template part that can be reused in multiple forms.
  • Blank

  • XML or Schema


  • We will start with the Blank Template from the Popular Form Templates category to create a simple form.



    In the coming posts we will see how we can add the validation rules and different submit options to the form.

    Tuesday, August 11, 2009

    An Introduction to Infopath 2010 - Part-I

    I will be posting set of articles covering the features of Infopath 2010 and how it is different from Infopath 2007 which is completely based on the Technical Preview release.

    In this post I will be providing a quick overview on InfoPath 2010.

    InfoPath 2010 makes our job easier for designing any electronic forms without writing any code by using easy-to-use tools provided out-of-the-box. It also includes the Office UI (Ribbons) for easy access of the controls while designing the forms - an autstanding UI. With a few clicks users can customize SharePoint list forms, add custom layouts and rules to validate the data.

    In this version, InfoPath comes with two flavours within the single installation:

    1. InfoPath Designer 2010
    Designer 2010 comes with a Good User Interface specifically for the designers to design the forms with easy-to-use tools.

    Following image shows the Form designed in InfoPath Designer 2010:



    2. InfoPath Editor 2010
    Editor 2010 comes with a Fluent UI with much improved, simpler user experience for filling out forms.

    Following image shows the Form opened in InfoPath Editor 2010:



    This is not same case with InfoPath 2007, where we will be doing both the activities in the single tool.

    We can consider InfoPath forms for most of the simple form based applications. We can even think about associating an InfoPath form to a SharePoint List.

    Please stay tuned to know more about my experiences with InfoPath 2010...

    Monday, August 10, 2009

    Office Professional 2010 (Technical Preview) Installation Error

    Recently I received an invitation from Microsoft to Participate in the Technical Preview Program. As part of this I downloaded Office 2010 Professional Edition.

    When I tried to upgrade my Office 2003 in one of our XP machine I got the following error message:

    "Microsoft Office Professional 2010(TEchnical Preview) encountered an error during setup. Error 1327. Invalid Drive F:\"



    Though there was an error during the setup, luckily Office 2010 got installed.
    I feel that the error occured while upgrading the office 2003 to 2007, because of that I have both the softwares on machine.

    I hope this will be fixed in the actual version of the Office 2010...

    I even tried upgrading Infopath 2010 and got the similar error as shown in the following images.





    Here also Infopath installed successfully though there was an error during installation/setup.