Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

    Advertisements
  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand
  • Advertisements

Posts Tagged ‘infopath’

Print button on InfoPath form

Posted by Paul on March 26, 2014

In this article we can explore a real-life scenario to show a Print button on an InfoPath form in view/edit mode. You can also extend the solution to other list forms.

Why Print button needed on forms?

By default there is no print button on SharePoint forms.

clip_image002

Steps

Following are the steps needed to achieve the Print button solution. We are using HTML & JavaScript for the solution.

Step 1: Enable Modeless forms

By default the view/edit forms are opened in dialog forms. We need to change this to edit the page.

Choose List > List Settings > Advanced Settings

clip_image004

Set the last option to No.

Now you can see the View form is opened in full page mode.

clip_image006

Following is the Edit form.

clip_image008

Step 2: Edit Page

Open a list item in View Form, Choose the Site Actions > Edit Page option to bring the page to edit mode. Add a Content Editor Web part & enter the following HTML contents.

<input onclick=”window.print();” type=”button” value=”Print”/>

clip_image010

Click OK to save the changes. Choose Stop Editing from the page tab. The page will look like below.

clip_image012

We added a Print button which will invoke window.print() method on click.

Step 3: Test the page

Refresh the list & open a list item in View Page. Click on the Print button & you can see the Print Dialog appearing like below.

clip_image014

This confirms the print functionality integration. You can also repeat the same for Edit form.

Step 4: Enable back dialog

Now we need to enable back the dialog form. Go to List Settings > Advanced Settings & enable the Dialog option.

clip_image016

You can see the Print button there too.

clip_image018

The print() method prints the contents of the current window.

Custom Action

For having a custom action you can refer the solution below:

http://infopathprinter.codeplex.com/

clip_image020

References

http://www.w3schools.com/jsref/met_win_print.asp

Summary

In this article we have explored a scenario of showing Print button on InfoPath forms.

Advertisements

Posted in SharePoint, SharePoint 2010, SharePoint 2013 | Tagged: , , , | Leave a Comment »

Using InfoPath Forms

Posted by Paul on March 31, 2012

InfoPath Forms are managed inside SharePoint through the

· Central Administration > General Application Settings > InfoPath Forms Services

clip_image004

What are the Tools needed?

You need InfoPath Designer 2010 to work with the examples in this article. You can download a Trial Version of Office 2010 Professional Plus 64 bit from here.

After installation you can start InfoPath Designer 2010 from the start menu.

clip_image006

Creating a Form

Now we can start by creating a Form and Deploying to our SharePoint site. Our aim is to have a simple form to capture the following fields:

· Title

· Full Name

· Address

Double Click on the SharePoint List button from the first screen of InfoPath Designer. You will get the following screen. Enter your site name there and click the Next button.

clip_image008

In the succeeding form enter your user credentials if prompted. The next wizard screen will be prompting to enter the List Name for the Form.

Note: The form which we are creating will be used to capture item information. This information is stored as a SharePoint list.

clip_image010

Click the Next button and then click Finish.

You will see the following Designer screen.

clip_image012

The Title and Attachments are two rows by default. As you will be knowing Title is the default field required and you change the caption.

Field Pane

There is a Fields pane on the right hand side from which you can drag and drop fields. You can even add new fields using the Add Field button.

clip_image014

Using the Form Designer

We can add or delete rows from the form. For example we can remove the Attachments field. Right click on the Attachments Row and use the menu item Delete > Rows

clip_image016

Now the Attachments row got deleted.

clip_image018

Now we need to add the Full Name field. For this right click on the Title row and use the menu option Insert > Rows Below.

Creating a New Field

As you can see that the Fields pane does not have a Full Name field. We need to add this now. Click on the Add field link from the Fields pane.

Enter the text Full Name in the Display Name area. The name area will be automatically filled as shown below. Leave the Data type as Single line of text itself.

clip_image020

Press the OK button and the new field is created.

clip_image022

Placing the New Field on the Form

We can just drag and drop the field and the label and text box are automatically created. But this is little tricky. In the designer drag the field to the form. If you see that the row is highlighted drop the field.

clip_image024

Now the user controls (label and textbox) are created as shown below.

clip_image026

Please repeat the same step for creating an Address field. This time you have to select a multiline textbox.

Once all the 3 fields are ready with input controls, the form would look like below:

clip_image028

Note: There is no OK and Cancel buttons as they will be shown by the runtime viewer.

Saving the Form

Now click on the Save button and enter the name as My InfoPath Form.

Publishing the Form

Now we are ready to publish the form to our SharePoint server. You can use the File > Publish > SharePoint List button to achieve this.

clip_image030

If the Publish was successful you will get the following dialog.

clip_image032

Click on the link in dialog to open the site.

clip_image034

Viewing the InfoPath Form

To view the InfoPath form we just created use the Add new item link. You can see the following screen.

clip_image036

Enter some details and click the Save button. If it goes well you can see the new item inserted.

clip_image038

So this concludes our usage of InfoPath form and Publishing it.

References

MSDN on InfoPath

More on InfoPath

Office Professional Plus

Comparison of InfoPath Features

Summary

In this article we have explored the usage of InfoPath Forms along with SharePoint 2010. In real world scenarios users can create their own InfoPath forms and publish to the SharePoint site. In the next article we can see about using Rules with InfoPath Forms.

Posted in SharePoint, SharePoint 2010 | Tagged: , , | Leave a Comment »

Customizing List Form with InfoPath

Posted by Paul on March 19, 2012

In this article I will take you through a real-world scenario of customizing List Form with InfoPath.

Scenario

By default SharePoint List form provides the Attach File option, but your client wanted the option underneath the form, instead on the ribbon.

clip_image002

How to achieve this?

clip_image004

There is a way of including the attach control in list forms, but time being I am not using it.

Steps

Please follow the steps below to achieve this. Time being we can play with the Announcements list.

Step 1: Create Announcements List

clip_image006

Step 2: Open InfoPath Designer

clip_image008

Choose SharePoint List & click the Design Form button on the right.

In the appearing page enter the Site URL as shown below.

clip_image010

Step 3: Save & Publish

Step 4: Test the form

How to remove the form?

In cases you might need to rollback to the old SharePoint list form, you can use the List Settings > Form Settings to achieve the same.

clip_image012

References

http://msdn.microsoft.com/en-us/library/gg180738(v=office.14).aspx

Summary

In this article we have explored how to customize a List form with InfoPath. You need to have Microsoft Office InfoPath Designer installed in your machine.

Additionally, the client machine does not need InfoPath Designer to fill the form. SharePoint & Browser takes care of the rendering part.

Posted in SharePoint, SharePoint 2010 | Tagged: , , , , | Leave a Comment »