Wednesday, 30 May 2018

Customize SharePoint List Forms

<script type="text/javascript">

$(document).ready(function()
{
   LoadDesign();
});


function LoadDesign()
{
   $(".ms-formtable").before($('.formdesigncls').html());
$(".ms-formtable").hide();
$("span .customdispForm").each(function()
{
//get the display name from the custom layout
   var displayName = $(this).attr("data-internalName");

displayName  = displayName.replace(/&(?!amp;)/g,'&amp;');
elem = $(this);
//find the corresponding field from the default form and move it
//into the custom layout
$("table.ms-formtable td").each(function(){
if (this.innerHTML.indexOf('FieldInternalName="'+displayName+'"') != -1){
$(this).contents().appendTo(elem);
}
});
});
     //hide OOB Design
$('.ms-formtable').next('table').hide()

}
</script>

<div class="formdesigncls" style="display:none" >

<table cellpadding="0" cellspacing="0" width="100%">
<tr>
   <td>
     <span class="customdispForm" data-internalname="Title"></span>
   </td>
</tr>
<tr>
  <td>
     <span class="customdispForm" data-internalname="ID"></span>
  </td>
</tr>
</table>

</div>


No comments:

Post a Comment