InfoPath 2010 Tutorial and Examples

In this InfoPath tutorial, we will discuss InfoPath 2010 tutorial and various InfoPath examples.

  • What is InfoPath 2010?
  • Auto-populate list data in InfoPath form in SharePoint
  • Add custom Submit or Save button in InfoPath 2010 form in SharePoint
  • Change default infopath 2010 form submission error message in SharePoint 2010
  • Change default InfoPath 2010 form submission successful message in SharePoint 2010
  • Submit data from Infopath form to SharePoint list using server object model
  • How to get value from people picker control in infopath in SharePoint?
  • Auto populate InfoPath 2010 people picker control in SharePoint 2010
  • Hide ribbon in InfoPath 2010 in SharePoint 2010
  • Show calculated date in field in InfoPath 2010 in SharePoint
  • Promote fields in InfoPath 2010 in SharePoint
  • Rule Inspector in InfoPath 2010 SharePoint 2010
  • Design checker in InfoPath in SharePoint 2010
  • Populate User Profile Properties in InfoPath 2010 in SharePoint 2010
  • Zip code validation in InfoPath
  • Phone number validation in InfoPath
  • Validate email address in InfoPath
  • InfoPath Replace function in SharePoint 2013/2010
  • substring-before() and substring-after in InfoPath 2013
  • Character limits validation in multiline textbox in InfoPath 2013/2010
  • Check Length in Custom Rule in InfoPath in SharePoint 2013
  • Convert field value to upper case or lower case in InfoPath in SharePoint 2013
  • Convert To UPPER case in InfoPath 2013
  • Convert to lower case in InfoPath 2013
  • Convert the first letter to UPPER case in InfoPath 2013
  • Open InfoPath form Hyperlink in Same Window in SharePoint 2013
  • InfoPath Designer 2013: Navigate to NewForm page on button click from EditForm page
  • InfoPath How to submit form to SharePoint Library as well as SharePoint List with specific Fields only?
  • Format Date in InfoPath form in SharePoint 2013
  • schema validation found non-datatype error in InfoPath 2010
  • Only date or date and time allowed InfoPath 2010/2010 error in SharePoint 2010/2013
  • Spell Checker in InfoPath browser enabled forms in SharePoint
  • The document could not be opened for editing. A Microsoft SharePoint Foundation Compatible application could not be found to edit the document
  • The form cannot be displayed because session state is not available
  • The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service
  • The form template cannot be published to the server. Sandboxed solutions are not enabled on the SharePoint server farm
  • Enable sandboxed solutions by using SharePoint Central Administration
  • Enable sandboxed solutions by using Windows PowerShell
  • The form cannot be submitted because of an error in SharePoint

SharePoint 2016 Tutorial Contents

What is InfoPath 2010?

Now, we will see what is InfoPath 2010? How can we use InfoPath 2010 with SharePoint 2010? And what are the new features in InfoPath 2010 in SharePoint 2010?

Basically, If you want to capture business information, then we can use InfoPath 2010 forms in SharePoint 2010. It is suitable from a small organization to an enterprise level. By using InfoPath 2010 simultaneously a thousand users can enter data. In SharePoint 2010 the new and most modified version is known as Microsoft InfoPath 2010.

Form libraries are used to store Infopath forms in SharePoint 2010. Its a SharePoint library, so we can use the features like workflow, columns, and user-defined views to enhance the interface etc. Infopath forms can use various workflows like approval workflows provided by SharePoint 2010.

Reporting and Business Intelligence capabilities in SharePoint 2010 help you extract the data from your forms and present it to business users.

InfoPath 2010 supports data connections to many data source types, including web services, XML files, and databases. So that you can communicate with external data sources.

There are lots of new features has been added to InfoPath 2010 like below:
The new InfoPath 2010 has looks of Microsoft Office 2010. It has features like Ribbon and Backstage view.

In InfoPath 2010 once the form is published, then users can consume in 3 ways.

  • InfoPath Designer: This provides the full design experience.
  • InfoPath Filler: InfoPath Filler is a new InfoPath desktop installation option for users who need to fill in and submit forms but do not need to modify or create new form templates.
  • Through browser: Users can consume InfoPath form through a browser.

Now in InfoPath 2010 there are lots of form templates available to design new InfoPath forms. One template is SharePoint List through which you can create attractive input forms on SharePoint lists with the click of a button. If you have existing data in SharePoint lists, you can quickly generate a new input form with all of the SharePoint column data.

There are more controls and functionalities are now supported in browser forms like:

Date and time control, Bulleted, numbered, and plain lists, Multiple selection list box, Combo boxes, Hyperlink capabilities, Person/Group pickers, Picture buttons etc.

InfoPath 2010 has one improved Rules task pane which helps in giving rules, validation, and conditional formatting. You can Add Rule or Manage Rule from the Rules task pane as well as from buttons available in Ribbon.

In InfoPath 2010 lots of new page layout templates are available in the Ribbon inside the Page Design tab. You can select any page layout while creating a form and also you can apply some theme.

The Backstage view ( which is also available in most of the Microsoft Office Products like Outlook, word or excel etc. ) is a major enhancement in the way you perform common tasks with your forms, such as printing, publishing, and setting form options. To access the Backstage view, simply click the File tab on the ribbon.

You can Publish the InfoPath form from the Publish your form button in the Backstage view. After you published the form later when user will modify and save forms to that published location.

You can write code from the code editor button available in the Ribbon under Developer tab.

Auto-populate list data in InfoPath form in SharePoint

Now, we will see how to auto-populate list data to a form in InfoPath in SharePoint 2010.

To auto-populate data from a list to a form, we have to follow the following steps.

Create a custom list and insert data into the list or we can import excel data to a list. Now open your InfoPath form and create a data connection with your custom list. Follow this article to create new data connection.

Now place the cursor at the textbox and Add rule. Then add action, give the name. Now give the condition as below.

Auto-populate list data in InfoPath form in SharePoint

Now expand Add dropdown and choose “set field’s value”. Click on field and choose list data connection, expand query field and then choose the column of that list from (ex.empid of list).

In the value field choose main data connection, expand data field and choose the field of the InfoPath form(ex.empid textbox of form). Now expand Add dropdown again and choose Query for data and choose secondary data connection (list data connection).

Now again choose set data connection from Add dropdown. In the field, choose another field, then choose main data connection, expand data field (ex.dept textbox of form)

To set value, click on fx. Then select field or group, show advanced view, choose list data connection, then expand data field, Choose the column, Click on Filter data, Click on Add, Choose the selected “field” “is equal to” same “filedname” as left. Click ok to close all dialog box.

Now we can set other fields using the above step. When the user input empid, all corresponding data pf user will auto-populated from the list in the form.

Add custom Submit or Save button in InfoPath 2010 form in SharePoint

Now, we will see how to add a custom Save or Submit button in InfoPath 2010 form in SharePoint 2010. We can easily add a custom Save button in a SharePoint 2010 list form using InfoPath 2010.

Follow below steps to add a custom button in InfoPath 2010 form in SharePoint 2010:

Open InfoPath 2010 in Designer Mode. Place the cursor where you want to insert the submit button. Go Home tab then Controls group and then click on the button you want to insert.

Select the button -> Control Tools then properties and in the Label put the name of the button and in Action choose submit option and in click in the submit Actions. Then in the dialog box choose your requirement as shown in fig.

Add custom Submit or Save button in InfoPath 2010 form

Go to File -> Publish -> Select your InfoPath 2010 form. It will connect to the server and shows successful publish message. Open your browser and then you can able to see your InfoPath form on the quick lunch.

Click on the Infopath form and add an item then click on submit. When you fill up the form and click on the submit button it will submit the data.

This InfoPath 2010 tutorial helps to add a custom Save or Submit button in the SharePoint list form customized in InfoPath.

Change default infopath 2010 form submission error message in SharePoint 2010

Now, we will discuss how to change the default InfoPath 2010 form submission error message in SharePoint. The default error message that comes in InfoPath 2010 is “The form cannot be submitted because of an error”.

We can change The form cannot be submitted because of an error message that usually appears if some error occurred like some validation fails or something else. This we can change in the Submit Options dialog box.

To change follow the below steps:

Step-1:
Open the InfoPath form in Design mode and then from the DATA tab in the Ribbon click on Submit Options as shown in the fig below.

Change default infopath 2010 form submission error message

Step-2:
Then in the Submit Options dialog box, select the Checkbox Allow the user to submit this form, And then click on Advanced >> button in the form like below:

Change default infopath 2010 form submission error message sharepoint

Step-3:
Now in the form select the checkbox “Show this message if the form submission fails”. And in the textbox enter whatever message you want to display as shown in the form below:

Change default infopath 2010 form submission error message sharepoint 2010

Then click on Ok, After that the new error message will come if form submission fails.

Change default InfoPath 2010 form submission successful message in SharePoint 2010

This InfoPath 2010 tutorial explains, how we can change the default InfoPath 2010 form submission successful message in SharePoint. The default successful message that comes in InfoPath 2010 is “The form was submitted successfully.” in SharePoint 2010.

We can change the form was submitted successfully. the message that usually appears if an InfoPath form successfully submitted. This we can change in the Submit Options dialog box. To change follow the below steps:

Step-1:
Open the InfoPath 2010 form in Design mode and then from the DATA tab in the Ribbon click on Submit Options as shown in the fig below.

Change default InfoPath 2010 form submission successful message in SharePoint 2013

Step-2:
Then in the Submit Options dialog box, select the Checkbox Allow the user to submit this form, And then click on Advanced >> button in the form like below:

Change default InfoPath 2010 form submission successful message in SharePoint 2010

Step-3:
Now in the form select the checkbox “Show this message if the form is submitted successfully:”. And in the textbox enter whatever message you want to display as shown in the form below:

Change default InfoPath 2010 form submission successful message

Then click on Ok, After that the new message will come if form successfully submitted.

Submit data from Infopath form to SharePoint list using server object model

Now, we will discuss how to Submit data from Infopath form to SharePoint list using the SharePoint object model.

Here we have a textbox and a submit button. On click of the submit button, we will save the textbox data to the SharePoint list.

Right click on the button, go to Button Properties… From the Properties window click on Edit Form Code button… This will open the visual studio where we will write the code.

Here we will use the SharePoint object model. So first add a reference to the MicroSoft.SharePoint.dll by going to the References folder and right click and click add references. The dll will be available under.Net category.

Write below code in the button click event and add the using statement like below:

using Microsoft.SharePoint;

using (SPSite thisSite = new SPSite(ServerInfo.SharePointListUrl.ToString()))
{
using (SPWeb web = thisSite.OpenWeb())
{
web.AllowUnsafeUpdates = true;
SPList listEmployees = web.Lists["Employees"];
if (list != null)
{
SPListItem item = list.Items.Add();
item["Title"] = MainDataSource.CreateNavigator().SelectSingleNode( "//my:field1",NamespaceManager).Value;
item.Update();
}
web.AllowUnsafeUpdates = false;
}
}

Now publish the infopath form and then it will add the textbox value to the SharePoint list.

How to get value from people picker control in infopath in SharePoint?

Now, we will see, how to get value from people picker control in InfoPath in SharePoint 2010 using SharePoint 2010 object model.

Below is the code to get the value from people picker control in InfoPath 2010.

XPathNavigator domNav = MainDataSource.CreateNavigator();
XPathNavigator XPNEAMName = domNav.SelectSingleNode("/my:myFields/my:EnjoySharePoint/pc:Person/pc:AccountId", NamespaceManager);
string accountid = XPNEAMName.Value;

Here the account id will return as “DomainName/UserName”.

Once we will get the account id then we can retrieve the name or email id like below:

using (SPSite thisSite = new SPSite(ServerInfo.SharePointListUrl.ToString()))
{
using (SPWeb web = thisSite.OpenWeb())
{
user = web.EnsureUser(AccountId);
string email = user.Email;
string name = user.Name;
}
}

Auto populate InfoPath 2010 people picker control in SharePoint 2010

This InfoPath 2010 SharePoint 2010 tutorial explains, how to auto-populate InfoPath 2010 people picker control in SharePoint 2010. We will see how username will be auto-populated in people picker control in InfoPath 2010.

First, create a data connection in InfoPath 2010 form.

Data -> Dataconnection -> Add -> Next -> SOAP web Service -> Type Address as http:///_vti_bin/UserProfileService.asmx -> NEXT

Choose GetUserProfileByName -> Next -> Next -> Next -> name the data connection -> Finish

Go to the main data connection in the InfoPath 2010 form. Select the desired people picker

Expand the people picker group -> dispalyname -> right click -> value -> fx -> Insert field or group -> chose GetUserProfileByName from data connection -> expand datafield -> values as shown in the fig below.

Auto populate InfoPath 2010 people picker

Then from Filter Data -> Add -> Select field or group from dropdownlist -> name -> is equal to -> type text “PreferredName” -> OK -> OK -> OK

Auto populate people picker in InfoPath 2010

PreferredName is case sensitive. So write as shown in the fig below:

Auto populate people picker in InfoPath 2010 sharepoint 2010

Click Ok for all dialog boxes.

Similarly to auto-populate manager name you have to choose only GetCommonManager when creating a data connection in the place of GetUserProfileByname and rest all steps are the same as above.

Hide ribbon in InfoPath 2010 in SharePoint 2010

This InfoPath 2010 tutorial explains, how to hide ribbon in InfoPath 2010 in SharePoint 2010. If you are using InfoPath 2013, then you can see this article on how to hide ribbon in InfoPath 2010.

You can hide the show or hide the ribbon in InfoPath 2010 easily through the forms option dialog box in SharePoint 2010.

Follow the below steps:

Step-1:
Open InfoPath 2010 form, go to File -> Info -> Form Options as shown in the fig below:

How to hide ribbon in InfoPath 2013 sharepoint

Step-2:
This will open the Forms Options dialog box.

There uncheck the “Show InfoPath command in Ribbon or toolbar” checkbox in the Web Browser category as shown in the fig below, then click on OK.

How to hide ribbon in InfoPath 2010

Step-3:
Now publish the Infopath form, the ribbon will not come.

This is how we can hide ribbon in InfoPath 2010/2013.

Show calculated date in field in InfoPath 2010 in SharePoint

Now, we will see how to use a calculated date in InfoPath 2010 in SharePoint 2010. Here we will see how the date will come as today’s date +10 days. Means suppose Today day is 16th Oct 2013, it should come as 26th Oct 2013.

To do this, Add a date picker to the InfoPath 2010 form from the Controls section. Right click on the control -> Click on Date Picker Properties…

This will open the Date Picker Properties window. Click on fx and then in the Insert Formula dialog box, click on Insert Function. Then chose Date category and chose addDays function and click on Ok as shown in the fig below:

Show calculated date in field in InfoPath 2010

Here addDays function took 2 parameter first is date and 2nd parameter is days. so it should like this: addDays(today(),10);

Now change the formula like below:

Show calculated date in field in InfoPath 2013

Now the properties window should look like below:

Show calculated date in field in InfoPath 2010 sharepoint

Now click on Apply and Ok, then publish the form. Now the field should populate with today date + 10 days.

Promote fields in InfoPath 2010 in SharePoint

Now, we will discuss how to add or promote fields to a document library if the form is already published using InfoPath 2010 in SharePoint 2010.

Follow below steps to promote column in SharePoint.

Open your InfoPath form, then go to File -> Info -> Form option as shown in the fig below:

Promote fields in InfoPath 2010

Choose property promotion from left and then click on Add button as shown in the fig below:

Promote fields in InfoPath 2013

Then it will show all your column names in the form. Choose the desired column and click on OK. For more columns to add follow step-2 to 4. Then click on OK to close the dialog box.

Rule Inspector in InfoPath 2010 SharePoint 2010

This InfoPath 2010 tutorial explains Rule Inspector feature in InfoPath 2010. Here is an interesting feature in Infopath 2010 known as Rule Inspector which is useful to capture all the validation or rules written in your InfoPath form.

Below are the steps to use Rule Inspector in InfoPath 2010/2013.

If you want to see what are the rules you have written for each control, below are the steps to follow.

Open your predesigned InfoPath form, add whatever validation, action, rules to validate the form. Click on data menu, from rules task pane click on Rule Inspector as shown in the fig below.

Rule Inspector in InfoPath 2010

Here it will show all the rules associated with each control in the form. And also you can print all the rules by clicking on the Print button.

Design checker in InfoPath in SharePoint 2010

This InfoPath 2010, we will discuss Design checker in InfoPath 2010/2013 in SharePoint 2010.

Design checker is used to showing the no of errors and warnings in your InfoPath form.

Follow the below steps to check design checker in InfoPath in SharePoint 2010.

Design your InfoPath 2010 form. To check the errors go to file -> click on Design Checker. It will show the errors and warnings as below image.

Design checker in InfoPath 2010 sharepoint

If the check on verify server and click on any error or warning, it will as like below.

Design checker in InfoPath 2010

For those controls that do not need send data to the server when the value of the control changes, set to “Never” on controls properties -> browser form.

Design checker in InfoPath in SharePoint 2010

This is how we can check the design checker in InfoPath 2010 in SharePoint 2010.

Populate User Profile Properties in InfoPath 2010 in SharePoint 2010

Now, we will discuss, how to populate user profile properties in InfoPath 2010 form in SharePoint 2010.

Create a data connection in InfoPath 2010 with user profile service in SharePoint 2010. Make sure you have to check “Automatic retrieve data when form is opened”. Add people picker to set the user account in the InfoPath 2010.

Click on data -> form load -> New -> Action -> Type name of the rule. Click on condition -> expand field drop-down -> choose select filed or group -> expand people picker group -> select AccountId -> in the middle drop down choose is blank -> OK

Then click on Add dropdown -> choose set field value -> Add your desired field -> click on fx next to value box -> insert field or group -> choose userprofileByName data connection -> then expand data field -> choose value -> filter data -> Choose name -> is equal to -> “Preferredname” -> OK -> OK -> OK

Like this, you can set other fields to get data on form load.

Account Name=value[Name="AccountName"] First Name=value[Name="FirstName"] Last Name=value[Name="LastName"] Work Phone=value[Name="WorkPhone"] Office=value[Name="Office"] Department=value[Name="Department"] Title=value[Name="Title"] Manager=value[Name="Manager"] UserName=value[Name="UserName"] Work Email=value[Name="WorkEmail"]

This tutorial learned how to Populate User Profile Properties in InfoPath 2010 in SharePoint 2010.

Zip code validation in InfoPath

This InfoPath 2010 tutorial explains, how we can do zip code validation in Infopath 2010 in SharePoint 2010.

Follow below steps for Zip code validation in InfoPath in SharePoint.

Add a textbox to the InfoPath 2010 form. Select the text box and click on Manage Rules, then from the Rules window Select New -> Validation.

Zip code validation in InfoPath designer sharepoint

Give a name in “Details For”, here we have given rule as “Rule for Zip Code Validation”. Now click on the condition None, this will open the Condition dialog box, Here First select the control and 2nd Select “does not match pattern” and in the 3rd click on Select a pattern as shown in the fig below:

Zip code validation in InfoPath 2010

This will open the “Data Entry Pattern” where you can select based on the custom pattern or also you can define a custom pattern as shown in the fig below:

Zip code validation in InfoPath 2010

Now the condition dialog box should look like below:

Zip code validation in InfoPath

Now save and publish the form. Now if you will not enter a zip code in the correct format, then it will show an error message.

This is how to validate zip code in InfoPath 2010 in SharePoint 2010.

Phone number validation in InfoPath

This InfoPath 2010 tutorial explains, how we can do phone number validation in Infopath 2010 in SharePoint 2010.

Follow below steps for Phone number validation in InfoPath 2010:

Add a textbox to the InfoPath form. Select the textbox and click on Manage Rules, then from the Rules window Select New -> Validation.

Phone number validation in InfoPath

Give a name in “Details For”, here we have given rule as “Rule for Mobile Number Validation”.

Now click on the condition None, this will open the Condition dialog box, Here First select the control and 2nd Select “does not match pattern” and in the 3rd click on Select a pattern as shown in the fig below:

Phone number validation in InfoPath 2010

This will open the “Data Entry Pattern” where you can select based on the custom pattern or also you can define a custom pattern as shown in the fig below:

Phone number validation in InfoPath 2013

Now the condition dialog box should look like below:

validate phone number in Infopath 2010

Now save and publish the form. Now if you will not enter a phone number incorrect format, then it will show error message like below:

validate phone number in Infopath 2013

This is how we can validate a phone number in InfoPath 2010 in SharePoint 2010/2013.

Validate email address in InfoPath

This InfoPath 2010 tutorial explains, how to validate email address in InfoPath 2010 in SharePoint 2010.

Open your InfoPath 2010 form and you can add a textbox to the form which you want to validate as an email address.

Follow the below steps to validate email address in InfoPath in SharePoint 2013/2010.

Select the control (textbox) in the InfoPath form. Then click on Add Rule -> Is not an E-mail address -> Show validation error as shown in the fig below:

Validate email address in InfoPath 2010

You can change the rule details also. You can change the Screen Tip message from the Rules window like below:

Validate email address in InfoPath 2013

If you want to show the validation message in a Dialog box rather than in Screen Tip then Click on Show more options in the Rules window like below:

InfoPath 2013 email address validation

Then give the dialog box message as well as choose Show Screen Tip and dialog box message radio button like below:

InfoPath 2010 email address validation

Now save and publish the InfoPath form and if you enter an invalid email address, then the validation message will appear like below:

how to validate email address in InfoPath 2013

This is how we can validate email address in InfoPath 2013/2010.

InfoPath Replace function in SharePoint 2013/2010

This SharePoint 2013 tutorial explains we will discuss how to use InfoPath Replace function in SharePoint 2013/2010 in InfoPath 2013/2010.

Recently I came across a situation where I need to replace blank spaces with underscores (_). I was just thinking if there is any direct function for replacing which was not there.

The way I did by using the translate function. Open the Insert Formula dialog box (Open the Rule Details dialog box and then click on fx in the Value textbox).

Then in the Insert Formula write the function like below:

translate(Title," ","_").
InfoPath Replace function in SharePoint 2013

Here Title is the Field name, 2nd parameter is the value you want to replace (my case it is blank space (” “)) and 3rd parameter is which value you want to replace (I want to replace with an underscore (“_”)).

Now if you will put Bijay Kumar Sahoo, it will appear as Bijay_Kumar_Sahoo

InfoPath Replace function in SharePoint

This InfoPath 2013 tutorial explains how to use Replace function in SharePoint 2013 in InfoPath 2013.

substring-before() and substring-after in InfoPath 2013

This InfoPath 2013 tutorial explains, string-before() and string-after() function in InfoPath 2013/2010 in SharePoint 2013/2010. These two functions we can use for string manipulation.

substring-before() and substring-after in InfoPath 2013

Syntax: substring-before(field1,field2)

Her it will return the text presented in field1 that precedes the first occurrence of field2.

Example:

substring-before(“Bijay Kumar”,” “) will return “Bijay”.

Here we are doing string manipulation based on blank space.

Similarly substring-after(“Bijay Kumar”,” “) will return “Kumar”

In place of “Bijay Kumar”, you select your field.

The rules should look like below:

InfoPath 2103 string-before and string-after function in SharePoint

Similarly, if you want to retrieve the first character of a string you can use the substring function like below:

substring(“Bijay”,1,1) – This will return “B”.

Here we learned how to use substring-before() and substring-after in InfoPath 2013 in SharePoint 2013.

Character limits validation in multiline textbox in InfoPath 2013/2010

This InfoPath SharePoint tutorial explains, how we can limit characters on multiline textboxes in InfoPath 2013/2010 in SharePoint 2013/2010.

If you are using a single line of textboxes in your InfoPath 2013 form and you want to restrict users to enter a specific number of characters then you can do this by right click on the control and go to properties and you can set the character limits.

But if you make the textbox as multiline then the option to limit the number of characters will not come. But still, you can do this by using the rule in InfoPath forms.

Steps:
Open your InfoPath form using InfoPath 2013 designer and then add a new rule (validation rule) (Select the text box and then from the ribbon click on Home and then Manage Rules). Then set the condition as The expression and then write string-length(.)>500.

Character limits on Multiline Boxes in InfoPath 2013 or 2010
Character limits on Multiline Boxes in InfoPath 2013 or 2010

Now publish the InfoPath 2013 form to SharePoint Online/2013 and if you will enter more than 50 characters then it will show a message like below:

Character limits on Multiline Boxes in InfoPath 2013 or 2010
Character limits on Multiline Boxes in InfoPath 2013 or 2010

Check Length in Custom Rule in InfoPath in SharePoint 2013

This InfoPath SharePoint 2013 tutorial explains, how to check the length of a field in InfoPath in SharePoint 2013 using a custom rule. We can check the length using an inbuilt function in SharePoint. But here we will see how to do this using rule in SharePoint 2013 InfoPath.

Open your InfoPath 2013 form and then add the rule for the textbox. And in the expression it should look like below:

string-length(translate(., “()- “, “”)) = 10

Check Length in Custom Rule in InfoPath in SharePoint 2013
Check Length in Custom Rule in InfoPath in SharePoint 2013

Convert field value to upper case or lower case in InfoPath in SharePoint 2013

This InfoPath SharePoint 2013 tutorial explains, how we can convert field value to lower case or upper case in InfoPath 2013 in SharePoint 2013. Also, we will discuss how to convert to upper case using Rules in InfoPath 2013 in SharePoint 2013/Online. How to convert to lower case using rules in SharePoint 2013/Online in InfoPath 2013. I will also show how to convert the first letter to UPPER case in InfoPath 2013.

Recently while working in an InfoPath form for SharePoint 2013, I got a requirement like whenever a user enters something in a textbox, the value should be converted to upper case letter.

We can convert to different cases without using a code, by simply writing a rule in InfoPath in SharePoint 2013.

So you can add a rule and write the below expression according to your requirement:

Convert To UPPER case in InfoPath 2013

Below is the InfoPath rule to convert to Upper Case in SharePoint 2013 InfoPath form. The rule you can write in the particular field on which you want to convert to upper case.

If you are new to InfoPath 2013 rules, read an article on InfoPath 2013 show hide section using Rules in SharePoint online.

translate(my:FieldName, "abcdefghijklmnopqrstuvwyxz", "ABCDEFGHIJKLMNOPQRSTUVWYXZ")

Convert to lower case in InfoPath 2013

Below is the InfoPath rule to convert to lower case in SharePoint 2013 InfoPath form.

translate(my:FieldName, "ABCDEFGHIJKLMNOPQRSTUVWYXZ", "abcdefghijklmnopqrstuvwyxz")

Convert the first letter to UPPER case in InfoPath 2013

Below is the InfoPath rule to convert to the first letter to Upper Case in SharePoint 2013 InfoPath form.

concat(substring(translate(my:FieldName, "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), 1, 1), substring(my:FieldName, 2, string-length(my:FieldName) - 1))
Convert field value to upper case or lower case in InfoPath in SharePoint 2013
Convert field value to upper case or lower case in InfoPath in SharePoint 2013

Open InfoPath form Hyperlink in Same Window in SharePoint 2013

Now, we will discuss how to open InfoPath hyperlink in the same window in SharePoint 2013. Recently in one of my InfoPath form, I was in a need to put one hyperlink in one of the views in the InfoPath form.

By default when you click on the hyperlink in InfoPath form, the page will open in a new window. But sometimes you may not need that. As in my case, I wanted to open that in the same window.

I did not find any configuration inside the InfoPath form to open in the same page. So I use jQuery to do this. Basically, I remove the target attribute of the hyperlink through jQuery.

Below is the code which you can put in a script editor page. Edit the page where you have put the InfoPath form and then add a script editor web part. This will remove all target attribute from all the links in the page. If you required to remove from a particular hyperlink then you need to modify the code.

<script src="https://SiteURL/SiteAssets/jquery.min.js"></script>
<script type="text/javascript">
function openLinkInSameWindow() {
$('a[target="_blank"]').removeAttr('target');
}
_spBodyOnLoadFunctionNames.push("openLinkInSameWindow");
</script>

InfoPath Designer 2013: Navigate to NewForm page on button click from EditForm page

This SharePoint tutorial explains, how to navigate from NewForm.aspx page to EditForm.aspx page with query string parameter from a button click using JavaScript and jQuery in SharePoint.

Here the SharePoint list form is customized using InfoPath designer 2013. Here in my Edit form page, there is a button and my requirement is on click of that button New form should open and it should take the ID as a query string parameter.

Edit the Edit form page and then add a script editor web part and insert the below code in the script editor web part.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<SCRIPT type=text/javascript>
var itemId =";
jQuery(document).ready(function() {
JSRequest.EnsureSetup();
itemId = JSRequest.QueryString[“ID"];

});

function test()
{

var button = document.getElementById('ctl00_ctl39_g_377139d0_8e3d_4bd2_b076_5fe8f9fae83b_FormControl0_V1_I1_B5');

document.getElementById('ctl00_ctl39_g_377139d0_8e3d_4bd2_b076_5fe8f9fae83b_FormControl0_V1_I1_T1').value=itemId;

if(button.addEventListener)
{
button.addEventListener(“click", function() {
window.open(“https://SiteURL/Lists/Test2/Item/newifs.aspx?ParentItemID="+document.getElementById('ctl00_ctl39_g_377139d0_8e3d_4bd2_b076_5fe8f9fae83b_FormControl0_V1_I1_T1').value);

} );

}
}

window.onload =test;

</script>

InfoPath How to submit form to SharePoint Library as well as SharePoint List with specific Fields only?

This InfoPath SharePoint 2013 tutorial explains, how we can submit an InfoPath form data to a SharePoint document library as well as to a SharePoint list in SharePoint 2013/2016 or SharePoint Online. We will see how we can use SharePoint workflow to save InfoPath form data to SharePoint 2013/Online list.

Assume you have a SharePoint InfoPath form and you want when user submit the form it should save the form in the Library as well as it will put some data to a SharePoint list.

Steps:
First, design the form using InfoPath 2013 and then publish the form to a SharePoint 2013/2016 or SharePoint Online form library. But here one thing to note is that you should promote those fields which you want to put into the SharePoint list.

Once you promote columns then those data will appear as SharePoint 2013 form library columns.

Then Create a SharePoint 2013 designer workflow and attach that workflow to the SharePoint 2013 form library. And make sure you trigger the workflow whenever a new item is created in the form library.

In that workflow add a “Create New List Item” action and populate all the fields with the data from the form. Since you have promoted those fields then all these fields will appear in the SharePoint workflow.

Once you deploy the SharePoint designer workflow, then it will create a new list item whenever an entry made to the SharePoint form library.

I hope this workaround will help you to submit a form to SharePoint Library as well as SharePoint List with specific Fields only in SharePoint 2013/2016 or SharePoint Online.

Format Date in InfoPath form in SharePoint 2013

In this InfoPath SharePoint tutorial, I am going to explain how to format the date in InfoPath 2013 in SharePoint 2013/2016/Online. I will show how we can format the date which returns from an inbuilt function like Date() or now().

Recently I got a requirement to display the current date in a single line of a textbox based on some rules.

For this requirement, you can use the InfoPath inbuilt function known as today() or now(). But here we will see how we can format the date from the default format yyyy-mm-dd to mm-dd-yyyy.

By default if you will try to populate current date by using Date() function in InfoPath 2013, it will appear in yyyy-mm-dd like below:

 Format Date in InfoPath form in SharePoint 2013
Format Date in InfoPath form in SharePoint 2013

But you can do some string manipulation if you want to have in a different format like mm-dd-yyyy or dd-mm-yyyy.

Below is an example:

concat(substring(today(), 6, 2), "/", substring(today(), 9, 2), "/", substring(today(), 1, 4))

concat(substring(now(), 6, 2), "/", substring(now(), 9, 2), "/", substring(now(), 1, 4))

Now after this string manipulation the date will appear like below:

infopath date format dd-mm-yyyy
Format Date in InfoPath form in SharePoint 2013

schema validation found non-datatype error in InfoPath 2010

Recently I got this schema validation found a non-datatype error while working with InfoPath 2010 in SharePoint 2010. By following this article I was writing SharePoint object model code to bind list data to a repeating table.

Below is the object model code to bind to a repeating table in InfoPath 2010 in SharePoint 2010.

SPListItemCollection items = listEmployees.GetItems(objquery);

if (items.Count > 0)
{
foreach (SPListItem item in items)
if (item != null)
{
using (XmlWriter writer = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:group1", NamespaceManager).AppendChild())
{
writer.WriteStartElement("group2", myNamespace);

writer.WriteElementString("rptEmployeeID", myNamespace, item["Title"].ToString());
writer.WriteElementString("rptFirstName", myNamespace, item["fname"].ToString());
writer.WriteElementString("rptLastName", myNamespace, item["lname"].ToString());

writer.WriteEndElement();
writer.Close();
}
}
}

Here I got the error because the filed’s order defined in the Infopath form is different from the order in which I am binding.

In InfoPath form the order was: rptEmployeeID, rptLastName and rptFirstName. But I was binding like below:

writer.WriteElementString("rptEmployeeID", myNamespace, item["Title"].ToString());
writer.WriteElementString("rptFirstName", myNamespace, item["fname"].ToString());
writer.WriteElementString("rptLastName", myNamespace, item["lname"].ToString());

Here rptLastName should bind before rptFirstName. So when I change order like below it worked for me:

writer.WriteElementString("rptEmployeeID", myNamespace, item["Title"].ToString());
writer.WriteElementString("rptLastName", myNamespace, item["lname"].ToString());
writer.WriteElementString("rptFirstName", myNamespace, item["fname"].ToString());

Only date or date and time allowed InfoPath 2010/2010 error in SharePoint 2010/2013

This InfoPath 2010 tutorial explains how to solve an error “only date or date and time allowed” which comes in InfoPath 2010/2013 in SharePoint 2010/2013 or SharePoint Online.

The error I got in below scenario, I have an InfoPath 2010/2013 form and there is one text box. In that text box, I need to populate today’s date in the InfoPath form. So I created a formula to populate today’s date. I write today(). Then I got the above error.

Even when I am trying to set default date to the date picker by using today() function, then the date appears like 2015-07-23 but it gave an error message “only date or date and time allowed” like below.

Only date or date and time allowed InfoPath

This happens when your regional settings on the SharePoint server is different from those on a client machine in which you edit the template in Infopath Designer. Infopath Designer and Filler use regional settings from local machine Windows while SharePoint server uses its own settings.

The solution is very simple. Instead of using today() you can use now() InfoPath 2010 function in SharePoint 2010.

Now the error only date or date and time allowed will not come in the InfoPath 2010 form.

Spell Checker in InfoPath browser enabled forms in SharePoint

This InfoPath 2013 SharePoint 2013 tutorial we will discuss spell checker in InfoPath 2013 in the browser-enabled forms. But spell checker is disabled in browser-enabled forms in SharePoint.

Actually, browser forms don’t support everything. An application like word use auto-language detection to determine where to start and stop the spell checking. InfoPath just assumes the default language.

So Microsoft is recommending to use ieSpell: To enable this valuable feature for browser forms, we recommend pointing your customers to an Internet Explorer extension called ieSpell. It will check the spelling in your document, just like you would expect it to; you even get to store your personal word list or (clever!) point ieSpell to a Microsoft Office dictionary.

After filling out a form, hit the ieSpell button and it pops up a dialog, similar to the Microsoft Office spell check. If you want to know the meaning of the word, the thesaurus is just a click away.

Installing the program is quick and easy. Download from here (free for non-commercial use). When you’re done, you will see a new button in the IE toolbar, as well as a new Tools menu item.

The document could not be opened for editing. A Microsoft SharePoint Foundation Compatible application could not be found to edit the document

In this InfoPath 2010 tutorial, we will discuss how to solve the error: The document could not be opened for editing. A Microsoft SharePoint Foundation compatible application could not be found to edit the document. The error comes when a user tries to open an InfoPath form in the application instead of the browser.

The user can open in the browser just fine and has been able to open the forms previously with no problem. A user is able to download the form to their desktop and open the form in InfoPath 2010. But when they try to open the form in the application from the context menu, the above error is shown.

In researching the error, I found a support posting that provided a clue to the problem. In it, the user is instructed to enable Add-Ons in their Internet Explorer:

  • Go to Tools in IE, click Internet Options
  • Click Programs at the top
  • Click “Manage add-ons” near the bottom
  • Click Publisher, then you can see all of Microsoft Corporation together
  • Scroll to SharePoint names (Maybe one or several)
  • Make sure they are all enabled by clicking on the name; the Enable button is towards the bottom.
  • Then click OK and OK and restart IE

The form cannot be displayed because session state is not available

In this SharePoint InfoPath tutorial, we will discuss how to resolve The form cannot be displayed because session state is not available error which comes in SharePoint 2010.

I got this error while associating a workflow that uses InfoPath form. The full error message is “The form cannot be displayed because session state is not available”.

The problem is inside the web.config file of the site collection in SharePoint.

First open the web.config file of your site collections and then navigate to the section.

Search for

<add name="Session" type="System.Web.SessionState.SessionStateModule"/>

If the line is commented then uncomment the line.

Previously:

<!– <add name="Session" type="System.Web.SessionState.SessionStateModule"/> –>

After modification:

<add name="Session" type="System.Web.SessionState.SessionStateModule"/>

The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service

This SharePoint tutorial, we will discuss how to fix error The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service.

I got this error message while publishing an InfoPath form to SharePoint. The full error message is:

The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service. For more information, contact your server administrator.

sharepoint infopath the form cannot be rendered

The reason for this error is because, State Service is not activated

Open SharePoint 2010 Central Administration. And then click on Configuration Wizards.

From the Configuration Wizards page, click Launch the Farm Configuration Wizard. Then click on Start the Wizard.

On the services configuration page, in the Services section, select the State Service check box as shown in the figure below:

the form cannot be rendered. this may be due to a misconfiguration

Then click on Next and then Finish.

The form template cannot be published to the server. Sandboxed solutions are not enabled on the SharePoint server farm

This InfoPath tutorial, we will discuss how to solve The form template cannot be published to the server. Sandboxed solutions are not enabled on the SharePoint server farm error.

I got this error while trying to publish an InfoPath form which contains code. The full error message is: “The form template cannot be published to the server. Sandboxed solutions are not enabled on the SharePoint server farm”.

The form template cannot be published to the server
The form template cannot be published to the server

We can solve the error by enabling Sandboxed Solutions in SharePoint. We can enable the sandboxed solution from SharePoint central administration as well as from PowerShell.

Enable sandboxed solutions by using SharePoint Central Administration:

Open SharePoint 2010 Central Administration and then click on System Settings. Then from the System Settings section, click Manage services on the server.

On the Services on the Server page, Check for Microsoft SharePoint Foundation Sandboxed Code Service, Click on the Start link as shown in the figure.

The form template cannot be published to the server InfoPath
The form template cannot be published to the server InfoPath

Once the service start, the status will become Started as shown in the figure below:

The form template cannot be published to the server. Sandboxed solutions are not enabled on the SharePoint server farm
The form template cannot be published to the server. Sandboxed solutions are not enabled on the SharePoint server farm

Enable sandboxed solutions by using Windows PowerShell:

Go to Start -> All Programs -> Microsoft SharePoint 2010 Products -> SharePoint 2010 Management Shell.

Then in the Windows PowerShell command prompt, type the following command:

Start-Service -Name SPUserCodeV4

The form cannot be submitted because of an error in SharePoint

This InfoPath tutorial, we will discuss how to fix the error “The form cannot be submitted because of an error” which comes in InfoPath SharePoint.

We get the error in workflow “The form cannot be submitted because of an error”.

the form cannot be submitted because of an error infopath

So follow the step for resolving that error:

In SharePoint Designer, go to All File and get to the attached workflow. Open and edit its .xoml.wconfig.xml file (the config file). Scroll down in order to find the Approvers section.

Delete xsi:nil=”true” in the Approvers and CC fields (see code below):

<d:Approvers >
<d:Assignment >
<d:Assignee/>
<d:Stage xsi:nil="true"/>
<d:AssignmentType>Serial</d:AssignmentType>
</d:Assignment >
</d:Approvers xsi:nil="true"> <!– from this line remove that xsi:nil="true" –>
<d:ExpandGroups>true</d:ExpandGroups>
<d:NotificationMessage/>
<d:DueDateforAllTasks xsi:nil="true"/>
<d:DurationforSerialTasks xsi:nil="true"/>
<d:DurationUnits>Day</d:DurationUnits>
<d:CC xsi:nil="true"/> <!– from this line remove that xsi:nil="true" –>
<d:CancelonRejection>false</d:CancelonRejection>
<d:CancelonChange>false</d:CancelonChange>
<d:EnableContentApproval>false</d:EnableContentApproval>

Save (ctrl+s), close SharePoint Designer, reopen it and publish the workflow. You can now retest the workflow startup from SharePoint and hope to not get the error!

If an error is again coming and that’s error is coming because when we change that file .xoml.wconfig.xml it is not saved properly whatever we changed. So for proper save updated to follow that step:

Open the Workflow in SharePoint Designer. From the Ribbon click Initiation Form Parameters. Click OK without changing anything

Republish the workflow, It will warn you that the InfoPath form has been customized. Open the Form that says needs an update, it will prompt you that the workflow has changed and InfoPath will update the form.

Save and Publish the Form. Publish the Workflow, again

Now if you check the .xoml.wfconfig.xml file, it will be updated to the proper version.

Hide Display Ribbon on an InfoPath 2010 Form

This InfoPath SharePoint tutorial explains, how to show hide the ribbon in an InfoPath 2010 form in SharePoint. Sometimes we do not need the ribbon to show in the InfoPath list form.

Suppose you have a customized list form that contains a Save button and you are doing custom actions on the button click. In that case, you may not need to show the Ribbon in the form.

For this Open the list form in Infopath, If it has not been already opened then Open the site in IE browser and then ribbon click on the List tab and then click on Customize Form Ribbon Item.

This will open the form in InfoPath. Then click on File -> Info -> Form Options.

There Uncheck the “Show InfoPath commands in Ribbon or toolbar” checkbox.

Hide Display Ribbon on an InfoPath 2010 Form
Hide Display Ribbon on an InfoPath 2010 Form

Then click on OK and then Save and Publish the form. After this whenever a user tries to edit an item, the ribbon will not appear.

You may like following InfoPath tutorials:

In this InfoPath 2010 tutorial, we saw below examples:

  • What is InfoPath 2010?
  • Auto-populate list data in InfoPath form in SharePoint
  • Add custom Submit or Save button in InfoPath 2010 form in SharePoint
  • Change default infopath 2010 form submission error message in SharePoint 2010
  • Change default InfoPath 2010 form submission successful message in SharePoint 2010
  • Submit data from Infopath form to SharePoint list using server object model
  • How to get value from people picker control in infopath in SharePoint?
  • Auto populate InfoPath 2010 people picker control in SharePoint 2010
  • Hide ribbon in InfoPath 2010 in SharePoint 2010
  • Show calculated date in field in InfoPath 2010 in SharePoint
  • Promote fields in InfoPath 2010 in SharePoint
  • Rule Inspector in InfoPath 2010 SharePoint 2010
  • Design checker in InfoPath in SharePoint 2010
  • Populate User Profile Properties in InfoPath 2010 in SharePoint 2010
  • Zip code validation in InfoPath
  • Phone number validation in InfoPath
  • Validate email address in InfoPath
  • InfoPath Replace function in SharePoint 2013/2010
  • substring-before() and substring-after in InfoPath 2013
  • Character limits validation in multiline textbox in InfoPath 2013/2010
  • Check Length in Custom Rule in InfoPath in SharePoint 2013
  • Convert field value to upper case or lower case in InfoPath in SharePoint 2013
  • Convert To UPPER case in InfoPath 2013
  • Convert to lower case in InfoPath 2013
  • Convert the first letter to UPPER case in InfoPath 2013
  • Open InfoPath form Hyperlink in Same Window in SharePoint 2013
  • InfoPath Designer 2013: Navigate to NewForm page on button click from EditForm page
  • InfoPath How to submit form to SharePoint Library as well as SharePoint List with specific Fields only?
  • Format Date in InfoPath form in SharePoint 2013
  • schema validation found non-datatype error in InfoPath 2010
  • Only date or date and time allowed InfoPath 2010/2010 error in SharePoint 2010/2013
  • Spell Checker in InfoPath browser enabled forms in SharePoint
  • The document could not be opened for editing. A Microsoft SharePoint Foundation Compatible application could not be found to edit the document
  • The form cannot be displayed because session state is not available
  • The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service
  • The form template cannot be published to the server. Sandboxed solutions are not enabled on the SharePoint server farm
  • Enable sandboxed solutions by using SharePoint Central Administration
  • Enable sandboxed solutions by using Windows PowerShell
  • The form cannot be submitted because of an error in SharePoint
free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)

envelope
envelope

Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

>