Solved

SharePoint display modal blank

Posted on 2016-10-18
2
52 Views
Last Modified: 2016-10-20
Hi All,

Using SharePoint 2010

My code below sort of works.  It brings up the form in the modal window but all the fields are always blank with no data.

Here's a piece of code
function onQuerySucceeded(sender, args) {
    var listItemInfo = '';
    var listItemEnumerator = collListItem.getEnumerator();

    while (listItemEnumerator.moveNext()) {
        var oListItem = listItemEnumerator.get_current();

        htmlTbl += "<tr><td><a href='#' onclick=OpenEditDialog("+oListItem.get_item('ID')+","+ oListItem.get_item('ter')+")>" + oListItem.get_item('Title') + "</a></td>"+ 
        "<td>" + oListItem.get_item('Project_x0020_Number') + "</td>" +
        "<td>" + oListItem.get_item('Project_x0020_Scope') + "</td>" +
....

function OpenEditDialog(item_title, item_id){
        var options = {
            url:"/my/personal/test/paProjects/Lists/Project%20Module%20New/Item/displayifs.aspx?List=8ce29c8c%2Deb89%2D4a0d%2D83f2%2D93559faee67c&ID=" + item_id+"ter="+item_title+",
            width: 500,
            height: 300
            };
 
        SP.UI.ModalDialog.showModalDialog(options);
    }
 

Open in new window

0
Comment
Question by:Isaac
2 Comments
 
LVL 9

Accepted Solution

by:
Karen earned 500 total points
ID: 41851505
First thing I notice is that you aren't putting quotes around what presumably are strings, you need to do something like

  htmlTbl += "<tr><td><a href='#' onclick=OpenEditDialog( ' " +oListItem.get_item('ID')+" ', ' "+ oListItem.get_item('ter')+" ' )>" + ...

I have put some unnecessary spaces in there so the single quotes show up more clearly.
Note you do not need to put the quotes around them if they are numbers (I can't tell if they are or not).

Also you look like you are passing the parameters in the wrong way around

ID then Title:
OpenEditDialog( ' " +oListItem.get_item('ID')+" ', ' "+ oListItem.get_item('ter')+" ' )>"

Title then ID:
function OpenEditDialog(item_title, item_id){
0
 
LVL 5

Author Closing Comment

by:Isaac
ID: 41852541
Thanks!
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

939 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now