Wednesday, September 30, 2015

how to bind peoplepicker control field login user in Sharepoint newform.aspx

Bind peoplepicker control field login user in Sharepoint

bind peoplepicker control field login user in Sharepoint
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="/SiteAssets/jquery.SPServices-2014.02.min.js"></script>

<script type="text/javascript">
 $(document).ready(function() {
 
  //Get the current user name
  var user= $().SPServices.SPGetCurrentUser();
 // alert(user);
  $("div[title='txt_Username']").text(user.split('|')[1]);
  var date=new Date();
$("#tdate").html(date);
$("input[title='txt_OriginalAuthor']").val(user.split('|')[1]);

  });

</script>

<input type="text" value="" maxlength="255" id="txt_OriginalAuthor" title="txt_OriginalAuthor" >

No comments:

Post a Comment