none
Open a Model Box, but with no redirects to a URL- i just want a pop up box with a message inside!

All replies

  • Hi,

    If you only want to show the message, we can use the code below to achieve it.

    <script type="text/javascript">
    function openBasicDialog(message,title){
    	var options = SP.UI.$create_DialogOptions();
    	var myhtml = document.createElement('div');
    	myhtml.innerHTML="<span>"+message+"</span>";
    	options.title= title,
    	options.html = myhtml,	
    	SP.UI.ModalDialog.showModalDialog(options);
    }
    </script>
    <a href="#" onclick="openBasicDialog('Dennis Test','modal dialog box');">Open POPUP</a>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, April 11, 2019 2:45 AM
    Moderator
  • Hi,

    If you only want to show the message, we can use the code below to achieve it.

    <script type="text/javascript">
    function openBasicDialog(message,title){
    	var options = SP.UI.$create_DialogOptions();
    	var myhtml = document.createElement('div');
    	myhtml.innerHTML="<span>"+message+"</span>";
    	options.title= title,
    	options.html = myhtml,	
    	SP.UI.ModalDialog.showModalDialog(options);
    }
    </script>
    <a href="#" onclick="openBasicDialog('Dennis Test','modal dialog box');">Open POPUP</a>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Hi Dennis,

    This is amazing. However, once I incorporate a URL link within it, the code no longer works... thoughts around this?

    Thanks so much in advance.

    Thursday, April 11, 2019 12:55 PM
  • Also, if I use two of the modal dialog boxes on the same SharePoint page, it doesn't work anymore. :/ 
    Thursday, April 11, 2019 12:58 PM
  • Hi,

    Do you want to add URL link in the dialog?

    If that is the case, we can use the code below.

    <script type="text/javascript">
    function openBasicDialog(message,title){
    	var options = SP.UI.$create_DialogOptions();
    	var myhtml = document.createElement('div');
    	myhtml.innerHTML="<span>"+message+"</span><a href='http://www.bing.com'>bing</a>";
    	options.title= title,
    	options.html = myhtml,	
    	SP.UI.ModalDialog.showModalDialog(options);
    }
    </script>
    <a href="#" onclick="openBasicDialog('Dennis Test','modal dialog box');">Open POPUP</a>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.


    Friday, April 12, 2019 1:35 AM
    Moderator
  • Hi,

    Please check the code below.

    <script type="text/javascript">
    function openBasicDialog(message,title){
    	var options = SP.UI.$create_DialogOptions();
    	var myhtml = document.createElement('div');
    	myhtml.innerHTML="<span>"+message+"</span><a href='http://www.bing.com'>bing</a>";
    	options.title= title,
    	options.html = myhtml,	
    	SP.UI.ModalDialog.showModalDialog(options);
    }
    </script>
    <a href="#" onclick="openBasicDialog('Dennis Test1','modal dialog box1');">Open POPUP1</a>
    <a href="#" onclick="openBasicDialog('Dennis Test2','modal dialog box2');">Open POPUP1</a>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Friday, April 12, 2019 1:37 AM
    Moderator
  • Hi,

    Do you want to add URL link in the dialog?

    If that is the case, we can use the code below.

    <script type="text/javascript">
    function openBasicDialog(message,title){
    	var options = SP.UI.$create_DialogOptions();
    	var myhtml = document.createElement('div');
    	myhtml.innerHTML="<span>"+message+"</span><a href='http://www.bing.com'>bing</a>";
    	options.title= title,
    	options.html = myhtml,	
    	SP.UI.ModalDialog.showModalDialog(options);
    }
    </script>
    <a href="#" onclick="openBasicDialog('Dennis Test','modal dialog box');">Open POPUP</a>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.


    Hi Dennis,

    When I tried to incorporate my own message into the box, it doesn't work... i.e., here it is.

    <script type="text/javascript">
    function openBasicDialog(message,title){
     var options = SP.UI.$create_DialogOptions();
     var myhtml = document.createElement('div');
     myhtml.innerHTML="<span>"+message+"</span><a href='http://www.bing.com'>Customer - Locating Accounts</a>";
     options.title= title,
     options.html = myhtml, 
     SP.UI.ModalDialog.showModalDialog(options);
    }
    </script>
    <a href="#" onclick="openBasicDialog('Account popped through UpStart but the address given by the customer doesn't match. Use the Customer- Locating Accounts to locate the correct amount.','modal dialog box');">Account popped through UpStart but the address given by the customer doesn't match</a>

    Monday, April 15, 2019 1:53 PM
  • Hi,

    Because, your message contains ', we need using \' instead it.

    <script type="text/javascript">
    function openBasicDialog(message,title){
    	var options = SP.UI.$create_DialogOptions();
    	var myhtml = document.createElement('div');
    	myhtml.innerHTML="<span>"+message+"</span><a href='http://www.bing.com'>Customer - Locating Accounts</a>";
    	options.title= title,
    	options.html = myhtml, 
    	SP.UI.ModalDialog.showModalDialog(options);
    }
     </script>
     <a href="#" onclick="openBasicDialog('Account popped through UpStart but the address given by the customer doesn\'t match. Use the Customer- Locating Accounts to locate the correct amount.','modal dialog box');">Accountpopped through UpStart but the address given by the customer doesn't match</a>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Tuesday, April 16, 2019 1:14 AM
    Moderator
  • Hi,

    Any update?

    If my reply help you, please mark the reply as answer, it will make others who stuck with the similar issue easier to search for valid solutions in this forum.

    Best regards,
    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, April 18, 2019 6:51 AM
    Moderator