Three ways of opening a list form in a Modal Dialog Box

This post described three ways of opening a list form in a Modal Dialog Box using JavaScript in a Content Editor Web Part.

First one simply add

onclick="javascript:SP.UI.ModalDialog.showModalDialog({ url: '../Lists/GBE/NewForm.aspx', title: 'User Survey' }); return false;"

to any hyperlinks

Second one calls a js function which has call backs

Third one is similar to the second one but with a check duplicates process. It uses client object model to check if an entry has been entered before new form is submitted.

The post also included an URL of how to add javascript to a custom web part

Advertisements

4 Extremely Useful SharePoint URL tricks

Edit Mode

To open any page in edit mode just append either ?ToolPaneView=2 or &ToolPaneView=2 to the url.  This includes List Item Forms where you would not otherwise be able to do this.

Web Part Maintenance Page

To open any page’s web parts maintenance page, where you can easily close or delete a web part which may be crashing it, append either ?contents=1 or &contents=1 to the url.

Open Page Modal (2010)

To see what a page would look like when opened in a modal dialog append either ?isdlg=1 or &isdlg=1 to the url.   This can be very useful, for example, in a Page Viewer Web Part or in a link in SPDesigner.

Setting Initial Ribbon (2010)

The Initial Ribbon open on a page can be set on the url also using the InitialTabId parameter.  For example:
…/default.aspx?InitialTabId=Ribbon.Read or ../default.aspx?InitialTabId=Ribbon.WebPartPage
To find out the id of a Ribbon, open the page in IE, press F12 to open the developer toolbar, click the arrow to turn on selection mode, then click the tab you want.  Look in the developer toolbar at the bottom for the <li> tag for the tab.  The part of the “id” attribute before the dash is the id of the Ribbon.

Reference:

http://spisnotthedevil.blogspot.co.nz/2012/12/4-extremely-useful-sharepoint-url-tricks.html#!/2012/12/4-extremely-useful-sharepoint-url-tricks.html