Solved

SharePoint display modal blank

Posted on 2016-10-18
2
39 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
Comment Utility
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
Comment Utility
Thanks!
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The viewer will learn how to dynamically set the form action using jQuery.
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…

772 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

10 Experts available now in Live!

Get 1:1 Help Now