?
Solved

SharePoint display modal blank

Posted on 2016-10-18
2
Medium Priority
?
77 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
Karen earned 2000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
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)
Suggested Courses

777 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