SharePoint Blog

InfoPath 2010: Form Library Modal Popup

In the last couple of weeks I have working on several InfoPath projects which are using form library’s to save the completed form. However I did not like the way the user was navigated away from the site to enter a new form, several of these forms I wanted to be rapidly completed and therefore I started to look at a different way to open the forms.

Of course in SharePoint 2010 we have the modal popup dialog, and after looking at a list form that had been customised with InfoPath, it appeared that it was possible to have a InfoPath form to load inside a modal popup.

The rest of this post details how you would achieve this.

The first step is to get your form ready and published, once this is complete head over to your form library and click add a new item.

Once the form has loaded copy the URL:

You will end up with something that looks like:

 HTML |  copy code |? 
<a href=""></a>

If you were to create a normal hyperlink to the above address, the chances are it will try and open in InfoPath client, so therefore we need to remind it to open in the browser using the syntax OpenIn=Browser. Therefore the link we now have saved looks like the following:

 HTML |  copy code |? 
<a href=""></a>

To open a form inside a modal popup, SharePoint 2010 uses JavaScript which is linked to in the following format:

 HTML |  copy code |? 
<a onclick="javascript:NewItem2(event, "INSERLINKHERE");javascript:return false;" target="_self">Open Form</a>

Insert your link in between the quotes where it says INSERTLINKHERE. Then insert the hyperlink on to a page, I had trouble inserting directly on to a page but inside the a content editor web part works just fine.

Now when we click the link you should receive a modal pop-up and not be redirected to a separate page.

If you don’t need the ribbon controls it can look even slicker:

About Chris Grist

Chris SharePoint Architect for Beach Energy in Adelaide, South Australia. Chris has specialised in SharePoint for the last few years and has over 12 years experience in the IT Industry. Catch Chris on twitter at @griStdoG View all posts by Chris Grist →
This entry was posted in InfoPath, SharePoint and tagged , , . Bookmark the permalink.

9 Responses to InfoPath 2010: Form Library Modal Popup

  1. Sara Tenenbaum

    Hi Chris,

    Can you give a sample of what the link itself INSERTLINKHERE would look like? since the infopath URL is so big I am not sure which parts of it do you put in.

  2. Chris Grist

    Hi Sara,
    updated to use devformatter so the code should be right now and you should be able to see the links properly. let me know if you have any issues.

  3. Chris Grist

    You basically put in all of the second link ive provided, which is the link SharePoint gives you, but with OpenIn=Browser added in.

  4. Sara Tenenbaum

    Thank you!

  5. David Wallach

    What is the code to get rid of the ribbon in the popup?

  6. Chris Grist

    Hi please see the instructions are on there

  7. Anita

    Hi – unfortunately this does not work for me. When I paste the code into content editor web part first the script remains – only if I click on “HTML source edit” and re insert the same code there, close that window, I will get the “Open Form” Link, but it does not work – cannot click on it – nothing happens…
    If you could point me to what is wrong I would really appreciate it.
    Thank you!

Leave a Comment

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>