Hot answers tagged

27

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 });


16

Juergen, The below article should help: http://blog.collabware.com/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) { ...


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 ...


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 ...


11

Found a solution. Add this to the end of the button click event: Context.Response.Write("<script type='text/javascript'>window.frameElement.commitPopup();</script>"); Context.Response.Flush(); Context.Response.End();


11

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


10

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; ...


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();


8

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: ...


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 = ...


7

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 ...


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 ...


6

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; }


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 = ...


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

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; ...


4

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: ...


4

The only scenario which gives the option of an alternative UI is the case where the sites were upgraded from WSS 3.0/SharePoint 2007, and you make use of the Visual Upgrade capability. This allows you to preserve the earlier look and feel to allow you to transition more slowly e.g. to give time to make any required changes to custom master pages. However it ...


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() ...


4

If you issue is that the master page is being applied to your dialog boxes, I was having a similar issue. I had images that were apart of the master page and they would 'push down' all the content, so the dialog box would be the size it should be based on the elements in it, but then because of the images, not everything could show on the screen. I fixed ...


4

When in Dialog mode the window.frameElement is NEVER null. use this as example on how to close it remotely var parentObject = window.frameElement; if (parentObject != null) { var waitDialog = parentObject.waitDialog; if (waitDialog != null) { waitDialog.close(); } }


4

I have added my comments to the above answers. Here are a couple additional - untested - suggestions: To build on Steve's suggestion, reload the url without IsDlg (simple, just not ideal from a performance viewpoint): window.location.href=window.location.href.replace(/[?&]IsDlg=1/,""); SharePoint uses the class s4-notdlg to identify what should be ...


4

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'; ...


4

It can be accomplished with context.Response.Write("<script type='text/javascript'>window.frameElement.navigateParent('myParentPage.aspx');</script>");


4

So what you want to do is to change the size of the dialog when the upload.aspx is closed. Try this code ExecuteOrDelayUntilScriptLoaded(function () { var dlg = window.parent.SP.UI.ModalDialog.get_childDialog(); dlg.$Q_0(800, 800); //width, height }, "sp.ui.dialog.js"); Also, if you want to size the dialog automatically without specifying the height ...


4

Referring directly the AssetPortalBrowser.aspx and getting the URL will be very much difficult, rather create an object and open the popup will be easier. Follow the below steps. I am getting the selected selected file in a text box and showing it in a alert. Go to Site Content > Site Assets Create a folder name Scripts Upload jquery-1.11.1.min.js and ...


4

I'm not sure if I understood you correctly. But when I want to open form I use asp:HyperLink and in codebehind I set NavigateUrl like this: hyperLink.NavigateUrl = "javascript:SP.UI.ModalDialog.ShowPopupDialog('" + url + "')"; If you want to open form (edit, view, etc) use copyutil - it can generate the exact url address for you: ...


4

In the first code snippet you have doubled the ' around getElementById. In the second code snippet you have forgotten the html: in front of getElementById Edit after James comment: If you are not using minimal download strategy, you do not have to use SOD.


4

Yes. You can place web part in any page and show this page in dialog. How to call dialog: MSDN: SP.UI.ModalDialog.showModalDialog(options) Method



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