none
Changing the Title for the javascript:SP.UI.ModalDialog.OpenPopUpPage

    Question

  • I have the following code snippet inside my web page:-

    <li class="ms-comm-adminLinksListItem" unselectable="on"><a href="javascript:SP.UI.ModalDialog.OpenPopUpPage(&#39;http://192.168.8.150/view/viewer_index.shtml?id=7432&#39;,null,800,775);" unselectable="on"> Live</a></li>

    but when the dialog pop-up opens it will have a title of "Dialog", so is there a way to define a custom title for the above dialog . currently the title will be as follow:-

    Monday, September 23, 2013 4:04 PM

Answers

  • Hi,

    You cannot pass on the title in this function call. You will have to replace OpenPopUpPage function with ShowmodalDialog function by defining in the format i mentioned previously.

    You will have to put in the definition for Showmodaldialog in a script tag and call the same from the anchor tag present in your li tag.

    Regards,

    Sharath


    sharath kumart shivarama

    Tuesday, September 24, 2013 2:27 AM

All replies

  • Hi,

    you can pass the title you want to be displayed while calling the method to open the page in the modal dialog.

    Please use the below reference for more light on the same

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

    In the below code, if you can see there is a variable called options that is created.

    You can just specify the title as options.title = "your custom title"

    <a href="javascript:openModalDialog('form.aspx');">Open My Custom Form</a>
    
    <SharePoint:ScriptLink ID="ScriptLink1" Name="sp.js" runat="server" OnDemand="true" Localizable="false" />
    
    <script type="text/ecmascript">
    
        var options;
        function openModalDialog() {
            options = SP.UI.$create_DialogOptions();
            options.width = 300;
            options.height = 100;
            options.url = SP.Utilities.Utility.getLayoutsPageUrl('customdialog.htm' );
            options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
            SP.UI.ModalDialog.showModalDialog(options);
    
        }
    
        function CloseCallback(result, target) {
            location.reload(true);
        }
    
    </script>

    Regards,

    Sharath


    sharath kumart shivarama

    Monday, September 23, 2013 6:20 PM

  • You can just specify the title as options.title = "your custom title"


    Thanks for the reply, but where i can specify the options.title = "your custom title" inside my original code:-

    <li class="ms-comm-adminLinksListItem" unselectable="on"><a href="javascript:SP.UI.ModalDialog.OpenPopUpPage(&#39;http://192.168.8.150/view/viewer_index.shtml?id=7432&#39;,null,800,775);" unselectable="on"> Live</a></li>
    
    


    Monday, September 23, 2013 11:04 PM
  • Hi,

    You cannot pass on the title in this function call. You will have to replace OpenPopUpPage function with ShowmodalDialog function by defining in the format i mentioned previously.

    You will have to put in the definition for Showmodaldialog in a script tag and call the same from the anchor tag present in your li tag.

    Regards,

    Sharath


    sharath kumart shivarama

    Tuesday, September 24, 2013 2:27 AM