Advertisement
In this article we have to show, how to populate values from
one list to another list.
We are having two lists one is Config and other one is
SharePoint List
In Config list we are having columns like Title and Body
In config list we added an item as shown below.
SharePoint Gantt Chart Web Part
update created by and modified by fields in SharePoint using client object model
SharePoint Gantt Chart Web Part
update created by and modified by fields in SharePoint using client object model
In SharePoint List Having Title, Platform and Body
While creating the Platform Column we selected the lookup
type selected the Config List and Click Ok.
We uploaded the Script in the Site Assets Library, in the
SharePoint List in the NewForm.aspx edit the page add the content editor refer
the script path.
<script type="text/javascript"
src="/sites/dotnetsharepoint/SiteAssets/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="/sites/dotnetsharepoint
/SiteAssets/jquery.SPServices-2014.01.min.js"></script>
<script language="javascript"
type="text/javascript">
$(document).ready(function()
{
$('select[title^="PlatForm"]').change(function() {
pathName=$("select[title^='PlatForm'] option:selected").text();
$(".ms-rtestate-write").html('');
$().SPServices({
operation:
"GetListItems",
async:
false,
listName:
"Config",
CAMLQuery:"<Query><Where><Eq><FieldRef
Name='Title'/><Value Type='Text'>"+pathName
+"</Value></Eq></Where></Query>",
completefunc:
function (xData, Status)
{
$(xData.responseXML).SPFilterNode("z:row").each(function()
{
bodycontent=
$(this).attr("ows_Body");
$(".ms-rtestate-write").html(bodycontent);
$("span[role='alert']").hide();
});
}
});
});
$('select[title^="PlatForm"]').prepend('<option
selected ="selected" value="">Select</option>');
$('select[title^="PlatForm"]').eq(0).selectedIndex
= 0;
$('select[title^="PlatForm"]').val('');
});
</script>
Finally we can able to see the Output as shown below.
0 comments:
Post a Comment