Pages

Subscribe:

Monday, November 26, 2012

SPDisplayRelatedInfo in SP 2010 JQuery


<script type="text/javascript">
$(document).ready(function(){
        //Gets the values from the Related List
         $().SPServices.SPDisplayRelatedInfo({
         columnName"Project",
         relatedList"Projects",
         relatedListColumn"Title",
         relatedColumns:["End_x0020_Date","Comments"],
         displayFormat"list",//shows the values in List,
         headerCSSClass"ms-hidden",// this is to hide the list 
        rowCSSClass:"ms-hidden",// this is to hide the list
        completefuncSetFields
        });
});

function SetFields(){
            var srcDivId = "SPDisplayRelatedInfo_Project ";
            var tds = document.getElementById(srcDivId).getElementsByTagName("td");
           
            if(tds.length>0)
            {
             var Column1Data1 = tds[0].innerHTML;
             var Column1Data2 = tds[1].innerHTML;
            
            $('#ctl00_m_g_8b1ecbc0_8438_4069_92d0_34cc9235ab90_ctl00_ctl05_ctl05_ctl00_ctl00_ctl04_ctl00_ctl00_TextField')[0].value = Column1Data1;
$('#ctl00_m_g_8b1ecbc0_8438_4069_92d0_34cc9235ab90_ctl00_ctl05_ctl07_ctl00_ctl00_ctl04_ctl00_ctl00_TextField')[0].value = Column1Data2;
      
}
}

1 comments:

  1. thank you, this a greate article , but I need to do it with multiple selection in dropdownlist.How to do it ? thanks

    ReplyDelete