37

May not be the best wat but it works: var test = "<div id='correspondence'>" + result + "</div>"; $('body').append(test); SP.UI.ModalDialog.showModalDialog({ html: document.getElementById('correspondence'), title: "Correspondence", allowMaximize: false, showClose: true, autoSize: true });


33

Juergen, The below article should help: http://www.collabware.com/blog/2013/03/22/tips-tricks-sharepoint-2013-modal-dialogs You have SP.UI.ModalDialog.showWaitScreenWithNoClose which can be used.. function RequestEnded(sender, args) { try { waitDialog.close(); waitDialog = null; } catch (ex) { } }; function RequestStarted(sender, args) { ...


22

Here's a better way than the code from John by using plain JavaScript (no need for jQuery) and without adding the element to the body manually: var element = document.createElement('div'); element.innerHTML = 'Hello World, I am the dialog content'; SP.UI.ModalDialog.showModalDialog({ html: element, title: 'My Dialog Title', allowMaximize: false,...


16

Try this: if (window.location.search.match("[?&]IsDlg=1"))


16

http://www.chakkaradeep.com/post/Using-the-SharePoint-2010-Modal-Dialog.aspx is a good example. Basically you create the Modal dialog like so... //Dialog Opening function OpenDialog() { var options = SP.UI.$create_DialogOptions(); options.url = '/_layouts/mySolution/myPage.aspx'; options.width = 500; options.height = 400; options....


13

You can use one of the following methods: SP.UI.ModalDialog.showWaitScreenSize or SP.UI.ModalDialog.showWaitScreenWithNoClose. Example: waitDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose("Loading...", "Please wait while data is retrieved...", 60, 280); --------wait for something-------- waitDialog.close(SP.UI.DialogResult.OK); Check out all ...


13

Here is a minimal HTML file that will make use of SP.UI.ModalDialog: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" type="text/css" href="/_layouts/15/1033/styles/corev15.css"/> &...


12

It seems you are missing SP.SOD.executeFunc. Try following. SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function() { var waitingDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Your action is in progress...', "Please wait while we generate the tasks for you."); }); I have tried it and output is following Reason SP.UI.ModalDialog execution ...


10

You need to call close() on object returned from showWaitScreenWithNoClose(). This works for me: var loading = SP.UI.ModalDialog.showWaitScreenWithNoClose(SP.Res.dialogLoading15); loading.close();


10

Try using commonModalDialogClose. Create function to close popup or directly call method. function CloseDlg() { SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.Cancel); } Or try to hide using class. $('.CloseSPPopUp').click(function(){ window.top.CloseSPUIPopoup(); }); function CloseSPUIPopoup{ $(".ms-dlgContent").hide(); } Use ...


8

The internal names of SP_UI_Dialog has changed in on RTM SP2013 on-premises so you should use: function _maximizeWindow() { var currentDialog = SP.UI.ModalDialog.get_childDialog(); if (currentDialog != null && !currentDialog.$Q_0) { currentDialog.$1Y_0(); } } ExecuteOrDelayUntilScriptLoaded(_maximizeWindow, 'sp.ui.dialog.js'); On the ...


7

There is this SP.UI.ModalDialog class (MSDN doku). With dialogOptions you can specify, how will your page behave after the user closes the dialog. function OpenMasterdataDialog(strPageURL) { var dialogOptions = SP.UI.$create_DialogOptions(); dialogOptions.url = yourPageWithDialogContent; dialogOptions.width = 750; dialogOptions.height = 950;...


7

just add .ms-dialog in front of the class you want to change, and it will only affect the modal dialogs: .ms-dialog .ms-cui-topBar2{ background-color: red; }


7

To open the view item form you need to open DispForm.aspx page for the List Item in a Modal Dialog. The URL for the list item will be something like http://server/Lists/ListName/DispForm.aspx?ID=1 where ID is the list item ID. To open it in a modal dialog use the following code snippet. function openDialog(pageUrl) { SP.UI.ModalDialog.showModalDialog( ...


6

I had the same task. I found that NewForm.aspx handles automatically query strings which surprised me. The query strings must use internal names. And there is no need for custom code. So to pre-fill Title in the NewForm.aspx (even if you see "Titel" or "Tittel" or something else), just add ?Title=Hurray, like SP.UI.ModalDialog.ShowPopupDialog("/Lists/Tasks/...


6

As shortcut you can use sg like: SP.UI.ModalDialog.showModalDialog( { html : $( "<h1>asdf</h1>" ).get( 0 ) } ); NOTE: if you have more than one tag you need to wrap everything into an embracing one otherwise only the first is shown: $( "<div><h1>asdf</h1><p>jkl;</p></div>" ).get( 0 )


6

The html option takes a DOM element rather than a string because of which you get this error. Try something like this: var htmlElement = document.createElement('p'); var messageNode = document.createTextNode('Message'); htmlElement.appendChild(messageNode); var options = { html: htmlElement, autoSize: true, allowMaximize: true, title: 'Title'...


6

The previous answer (where some data are concatenated into string, returned to the parent page and then split into values) seems to be a bit complicated and even redundant. Because we always can return data to the parent page as var returnValue = []; // array returnValue[0] = 123; returnValue[1] = 'hello'; SP.UI.ModalDialog.commonModalDialogClose(SP.UI....


6

The id of the close button is not just "DlgClose" it is "DlgClose< GUID >". For example, DlgClose355aef3c-ef2f-4293-a7b1-ffa236195624 In your jQuery code, you are using a begins-with selector ^ which gets all elements whose id starts with a particular string. (DlgClose in this case.) While in your JavaScript code, you are getting all the elements whose ...


6

You call your method showWaitScreenWithNoClose using asyncronously with callback ExecuteOrDelayUntilScriptLoaded. If sp.js is not loaded, then closing event can fire before the wait dialog is showed. Your code should look like this: var waitDialog = null; function BuildTable() { ExecuteOrDelayUntilScriptLoaded(function() { waitDialog = SP.UI....


6

Yes, You can fulfill this requirement. I assume, you are having 2 SP groups - Project Leaders & Finance Team and you want to redirect user based on their group membership after closing the dialog box. You can use SpServices.js for getting user membership. Download SPServices. Make sure you have Jquery reference in your page. I am updating part of your ...


5

you can open the modal dialog without a postback something like: <asp:Button runat="server ID="TestButton" onclick="javascript:...." The second point is that you dont need to put the whole path to the application page into the url. When you open the modal dialog from an application page AddCat.aspx would be enough. But how do I do this. First I build ...


5

Old answer: I found it! This code does the trick: function openDialog(pUrl) { var options = { title : "Kalender", width : 600, height : 400, url : pUrl }; SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options); } $('.ms-acal-month').ready(function () { setTimeout(function() { $('a[href*="...


5

SP.UI lives on another file, that is sp.ui.dialog.js You need to add it to the script references <script type="text/javascript" src="_layouts/15/sp.ui.dialog.js"></script>


5

You can, however it'll require adding code to the parent page and utilizing window.postMessage(). You will have to add an event listener on the parent page to listen for the message, and then open the dialog: window.addEventListener("message", receiveMessage, false); var receiveMessage = function(event) { if (event.origin !== "your app") return; //...


5

If you are using Script Editor than please use below mentioned code. <script type="text/javascript"> var suitebar = $("#suiteBar"); if(suitebar.length<1) $("#s4-ribbonrow").css('display','none'); </script> Add following CSS in your form pages like newform.aspx, dispform.aspx and editform.aspx, this way the ribbon will only be hidden in ...


5

You can do that for all lists/library within your site by setting NavigateForFormsPages to false via PowerShell. Open SharePoint Management Shell as Administrator. Run the following script line by line $web = Get-SPWeb -Identity http://rootsite/subsite foreach ($list in $web.Lists) { $list.NavigateForFormsPages = $false; $list.Update(); } where false ...


5

Try the below code in Script Editor Web Part <script> function openDialog(pageUrl) { var options = { url: pageUrl, title: 'Title of the Dialog', allowMaximize: false, showClose: true, width: 500, height: 500 }; SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options); } </script> <a href="#" onclick="openDialog('http://...


4

Actually, you can set it up so that you can use the Rich Text in IE9 (some people believe you have to disable it completely)! You just have to override 3 functions in form.js (I created a file called form.ie9fix.js) and make sure it loads AFTER the "normal" form.js (or form.debug.js, whichever). The functions in question: RTE_DD_GetMenuFrame() ...


Only top voted, non community-wiki answers of a minimum length are eligible