Study infopath Learning Series every day (2) "domains", "groups", and "controls"

Source: Internet
Author: User
Tags xml reader xslt

Specifically, infopath has many limitations in actual development. In the implementation process, we often need to solve some problems through the "saving the nation by curve" method. Some of them are still very confusing, but these flaws cannot prevent us from understanding this new development concept. We discussed the basic configuration of infopath form services and what we can do with infopath designer. In addition, I would like to declare in advance that this series will not specifically distinguish infopath 2010 or 2007. Although they have some differences, I think this is not important. What is important is that they share the same design approach and philosophy. The new version only makes up for some defects of the old version, and its nature remains unchanged. In fact, my previous projects were developed with 2007, and 2010 were not applied to specific projects. I have only studied it myself, so my real experience has accumulated in 2007. In addition, I will also introduce some differences between 2007 and 2010 in my article.

Let's get down to the truth. Let's take a closer look at the concept of domains, groups, and controls.

I. Prerequisites

1. Before that, we need to familiarize ourselves with some basic concepts of XML:

XML snippet of the following image <? XML version = "1.0" encoding = "ISO-8859-1"?> <Bookstore> <book category = "Cooking"> <title lang = "en"> everyday Italian </title> <author> Giada De laurentiis </author> <year> 2005 </year> <price> 30.00 </price> </book> <book category = "children"> <title lang = "en"> Harry Potter </title> <author> j k. rowling </author> <year> 2005 </year> <price> 29.99 </price> </book> <book category = "Web" cover = "paperback"> <title lang = "en"> learning XML </title> <author> Erik T. ray </author> <year> 2003 </year> <price> 39.95 </price> </book> </bookstore>

Based on the XML snippet above, we may need to know the meaning of each concept, such as root elements, attribute, siblings, text, value, parent, and child.

2. We also need to understand XSLT, XSD, XPath, and other concepts.

3. What is Microsoft Office XML formats and office open XML?

Ii. Formal start

1. Start from the entrance

From office 2010, infopath has been split into two different components, namely Microsoft infopath designer 2010 and Microsoft infopath filler 2010. Both 2007 and 2003 had only one component called Microsoft infopath 2010. Microsoft infopath designer 2010 is used to design form templates, while Microsoft infopath filler 2010 is used to fill in the design templates.

When you right-click an existing form, you can perform two operations: "Open" and "design". The former is to call filler to fill in the form template, if "design" is selected, the form template is opened with designer.

2. Create a blank form template

Open infopath designer 2010, and click "new", "SharePoint form library", and "design form". Then, infopath creates a new design window for us based on the default template.

Let's start with the design window layout of infopath. We don't need to consider the details first. In this section, I will first introduce the most basic application of infopath. only part of Area A and Area B will be involved. I will introduce other content one by one in the following articles. The following is a brief overview of the three regions.

Area A: the specific design page shows the obtained design method, similar to the operation of the Word document editing area.

Area B: on the right of the design form, we can see the field structure of the current form template (Unlike SQL, which is the structure of the XML node ).

Area C: ribbon-style functional areas are already very familiar to everyone. File, start, insert, page design, data, and development tools. These six labels run through the whole process of form development.

3. Save the created form

There is a line of shortcut buttons in the upper left corner of the program, which is very useful. It is generally the most commonly used: Save, quick release, undo, restore, and preview from the left. Click Save to bring up the Save dialog box. In the lower part of the dialog box, We will select the Save type of the form. There are two Save types in 2007 and 2010. There are four save types in total. It is worth noting that according to different types, the forms we design will also have some functional changes: Web browser form templates will have fewer functions than filler templates. Version 2007 has fewer template functions than version 2010. (What are the differences between them)

The saved file name is helloworld. xsn.

Go to the resource manager to find the file and change the extension name to. Zip. Open it with the compression software and find that it contains several files.

Decompress the package to your local device. We found that there are five XML files:

Manifest. xsf

The configuration file, as a main file defining all resources, can be designed through designer.

Myschema. XSD

The schema definition of XML is stored. We can use it in the workflow development process in the future.

Sampledata. xml

Sample Data definition file.

Template. xml

XML sample file when the user fills in the form template.

View1.xsl

The View File uses XSLT to style the XML file.

3. domain (element), group, and attribute

The field is the smallest particle in the Form Design in infopath. Every field is a node of the form template (which we understand for the time being ). The following two figures show different menus when I click different nodes. We can see that. The control type in Zone A varies depending on the selected node type. In the left figure, I select a node of the group type. Then, only the section control is displayed. In the right figure, I click a field (element) type and the data type is text. It has controls such as text box, drop-down list box, combo box, list box, And Option Button. I divide the following menus. Through this division, I feel that it is easier to understand the options in the menu.

Zone

The options in this region vary depending on the node type (node type and node data type. In the figure above, I selected a text element node. The available controls include a text box, a drop-down list box, a combo box, a list box, and an Option Button. If I select another one in the domain, more controls will pop up:

Region B:

In Area B, we can find operations such as adding, deleting, modifying, and querying nodes.

Region C

We mainly focus on "rules" and "programming" in this area. I feel that the highlight of infopath is "rules". It provides a very intuitive design method to customize the page logic, I will summarize in the following article ("study every day and learn more about infopath series (4):" rules "and" condition Formats. In addition, when we use infopath Forms Services for. Net-managed code development, we can develop programs for different nodes. Each node will have its own validiting and changed events. That is to say, each field can have its own verification and change events, making form development more flexible.

D Region

Copy Attributes With XPath.

Iii. instance exercises

The following example demonstrates how to publish the form we designed on infopath designer to infopath form services and open it in a browser. Through this instance, you can understand the domain, group, and attribute. They also know how they store and correspond to the corresponding XML nodes.

After the form template is created, we can see that there is only one node named "myfields" in the "field" Operation Panel on the right. Click the triangle button on the right of the node to bring up a shortcut menu, which contains the operable items for the currently selected node. Click "properties" first. A menu such as is displayed.

Pay attention to the namespace here. The first half is in the fixed mode, which is generally http://schemas.microsoft.com/office/infopath/2003/myxsd. The timestamp is the same as the timestamp of form urn. Here, it is 2011-03-05t15: 13: 42.

After you click "add domain", the "add domain or group" dialog box is displayed. The new types are generally domain (element), group, group (option), domain (attribute), and completed XML schema or XML document. The following table lists the XML nodes required to create a book order:

Procedure Description Type Data Type
1 Change the default myfields to bookstore. Group Default, cannot be modified
2 Under the root node (bookstore), click the menu and add a domain. Select "DUPLICATE" under "group" as the type ". Group None
3 Click the new domain under the book. The type is. Field (element) Text
3 Create a new domain under the book with the name of title Field (element) Text
4 Create a new domain under the title with the name Lang. Because the upper level is an element, the type can only be a field (attribute) Domain (attribute) Text
5 Create an element author under the book Domain (attribute) Text
6 Create an element year under Book Field (element) Integer
7 Create an element price under the book Field (element) Decimal

The final result is as follows:

Place the mouse focus in the appropriate position. Click the menu next to "book" and select "repetition section with controls ". Follow the modification style.

Next we will release this form. In the designer window, select a file | publish | Sharepoint Server

In the pop-up Publishing Wizard dialog box, enter the URL of the SharePoint website. Here is http: // SC/and then click "Next ".

Select related options for deployment, such as whether the form can be filled in with a browser, and where the form is published, form library, website content type, or form template approved by the Administrator.

Here I will describe three different deployment options:

Form Library

Deploy the form template in the form library in Sharepoint, which has the advantage of being flexible. However, a template can only be applied to one database, with poor flexibility and reusability.

Content type

Update to the website content type. We can reuse the content type in the website model through content type deployment.

Form templates reviewed by administrators

This method is required when you use vsta to develop managed code for form templates. He does not directly connect to SharePoint, but the website administrator needs to upload form templates in the SharePoint management center, but he can execute his managed code in the Sharepoint Server Farm. In the SharePoint management center, administrators can activate different website sets, and the second method is website.

In this example, select "form library" as the deployment type.

Because the "form library" is selected, what operations will be performed on the form library below to create or update templates in the existing form library. I chose to create a new form library.

In the dialog box below, enter the name of the new form library.

The following describes the fields to be published to SharePoint. The field can be used as the metadata field of the SharePoint library, and the other can be used as the parameter of the sharepointwebpart.

After confirming that the information is correct, click "publish.

It is displayed as completed. We can click "open this form in a browser" for testing.

Show the final result as shown in

Next, enter some form data. Click Save in the upper left corner.

Enter the name of the file saved in the form in filename, and then click Save

Click Close, find the form in the displayed form library, and download it to the local device. Open in notepad.

It can be seen that the icons for downloading to a local XML file are different from those for a common XML file. Let's ignore the reason. We use an XML reader to open the file.

Demo. xml <? XML version = "1.0" encoding = "UTF-8"?> <? MSO-infopathsolution name = "urn: Schemas-Microsoft-com: Office: infopath: bookstore: -myXSD-2011-03-05T15-13-42 "solutionversion =" 1.0.0.17 "productversion =" 14.0.0.0 "piversion =" 1.0.0.0 "href =" http: // SC/bookstore/Forms/template. xsn "?> <? MSO-application progid = "infopath. Document" versionprogid = "infopath. Document.3"?> <My: bookstore xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: My = "http://schemas.microsoft.com/office/infopath/2003/myXSD/2011-03-05T15:13:42" xmlns: XD = "http://schemas.microsoft.com/office/infopath/2003" XML: lang = "En-us"> <my: book my: Category = "computer"> <my: title my: lang = "English"> demo1 </My: title> <my: Author> scally1 </My: author> <my: year> 2011-03-09 </My: year> <my: price> 23 </My: price> </My: Book> <my: Book xmlns: my = "http://schemas.microsoft.com/office/infopath/2003/myXSD/2011-03-05T15:13:42" My: Category = "Social Science"> <my: title my: lang = "Chinese"> demo2 </My: title> <my: author> scally2 </My: Author> <my: Year xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"> </My: year> <my: price xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"> 34 </My: price> </My: Book> </My: bookstore> can be tested,

Set <? MSO-application progid = "infopath. Document" versionprogid = "infopath. Document.3"?> After this sentence is deleted and saved from the XML file, the icon becomes a common XML style.

This statement can control which local applications are used to open the XML file and display icons. For details, see Microsoft Office XML formats.

It is difficult to understand this structure if you are familiar with XML-related concepts.

At this point, we should have a basic understanding of the basic data structure of infopath. In the next section, I will put down the details and methods of Form Design, focus on the configuration options of form templates, and experience the importance of "View" in form design.

_____________________________________________________________________________________________________

About the series of directories

00. Study infopath Learning Series every day (0): at the beginning

01. Learn how to learn infopath every day (1): first recognized by form services and infopath

02. Study infopath Learning Series every day (2): "Domain", "group", and "control"

03. Study infopath series (3): "advanced form options" and "View"

04. Study infopath series (4): "rules" and "condition format"

05. Study infopath series (5): "Data Connection"

06. Study infopath Learning Series every day (6): more flexible integration of SharePoint through the document information panel

07. Learn infopath series (7): how to integrate form templates into workflows

08. Study infopath Learning Series every day (8): exploring how to deploy form templates

09. Study infopath Learning Series every day (9): Summary of problems encountered during infopath Development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.