locked
Open Form Library Dispform in popup modal RRS feed

  • Question

  • Dears,

    i need to when i click on title to open the Dispform  in a popup Modal window,

    how can i do this ?

    Sharepoint List

    Sunday, August 7, 2016 3:24 PM

Answers

  • Hi,

    The Form Library ID is not its GUID, you can click F12 and use arrow select the table to know its ID.

    Here is a detailed article for how to use F12 Developer Tools:

    https://msdn.microsoft.com/library/gg589512(v=vs.85).aspx

    Best Regards,

    Andy Wu


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    • Marked as answer by iwadds Wednesday, August 10, 2016 8:58 AM
    Tuesday, August 9, 2016 12:31 AM

All replies

  • you can modify the page using JQuery to achieve your requirement by SharePoint Designer.

    顺其自然地勇往直前!—Justin Liu

    Monday, August 8, 2016 12:17 AM
  • Hi,

    Please try to set the property "LinkToItem" of Field as "True" using PowerShell.

    https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfield.linktoitem.aspx

    Or also please check the below article of setting the property by editing AllItems.aspx

    http://sharepoint.stackexchange.com/questions/94968/sp2013-column-with-link-to-the-displayform-like-on-the-title-column

    Thanks,

    M. Gubendra Raj

    Monday, August 8, 2016 4:57 AM
  • Hi,

    According to your description, my understanding is that you want to open the Dispform in a popup Modal window when you click document name.

    We can achieve your needs via Script Editor Web Part and the code as below:

    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                ExecuteOrDelayUntilScriptLoaded(OpenForm, "sp.js");
            });
    
            var allItems;
            var FormsIDs=[];
    
            function OpenForm() {
                var context = new SP.ClientContext.get_current();
                var web = context.get_web();
                var list = web.get_lists().getByTitle('123');
                var query = SP.CamlQuery.createAllItemsQuery();
                allItems = list.getItems(query);
                context.load(allItems);
                context.executeQueryAsync(successGetForm);
    
                function successGetForm() {
                    var ItemURL = "";
                    var s = "";
                    var ListEnumerator = allItems.getEnumerator();
                    while (ListEnumerator.moveNext()) {
                        var currentItem = ListEnumerator.get_current();
                        var ItemId = currentItem.get_id();
                        FormsIDs.push(ItemId);
                    }
                    var t = document.getElementById('the Form Library ID');
                    for (var i = 1; i < t.rows.length; i++) {
                        s = "<a onclick='javascript:SP.UI.ModalDialog.OpenPopUpPage(&#39http://siteUrl /Forms/DispForm.aspx?ID=" +FormsIDs[i-1]+ "&#39,null,1000);return false;'href='javascript:void(0)'>" + t.rows[i].cells[3].textContent + "</a>";
                        t.rows[i].cells[3].innerHTML = s;
                    }
                }
            }
    </script>
    

    Here is a picture for the final rendering:


    Best Regards,

    Andy Wu


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    • Proposed as answer by VSharma Monday, August 8, 2016 5:28 PM
    Monday, August 8, 2016 11:22 AM
  • i tried your code, but this section is not processed properly.

     var t = document.getElementById('the Form Library ID');
                    for (var i = 1; i < t.rows.length; i++) {
                        s = "<a onclick='javascript:SP.UI.ModalDialog.OpenPopUpPage(&#39http://siteUrl /Forms/DispForm.aspx?ID=" +FormsIDs[i-1]+ "&#39,null,1000);return false;'href='javascript:void(0)'>" + t.rows[i].cells[3].textContent + "</a>";
                        t.rows[i].cells[3].innerHTML = s;
    
    t value is always null !!

    my Form ID is: {2433BF2B-A6BF-4BE8-9FB6-EA037B91AF2D}

    i tried to put it with/without parentheses and it did not work.

    please reply.

    Monday, August 8, 2016 4:26 PM
  • Is it a guid in your web browser?

    you can check the client id in your web browser to confirm the id.


    顺其自然地勇往直前!—Justin Liu

    Tuesday, August 9, 2016 12:16 AM
  • Hi,

    The Form Library ID is not its GUID, you can click F12 and use arrow select the table to know its ID.

    Here is a detailed article for how to use F12 Developer Tools:

    https://msdn.microsoft.com/library/gg589512(v=vs.85).aspx

    Best Regards,

    Andy Wu


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    • Marked as answer by iwadds Wednesday, August 10, 2016 8:58 AM
    Tuesday, August 9, 2016 12:31 AM