Get Form Field Values from DispForm.aspx, EditForm.aspx Pages in SharePoint

If you have a requirement to extract field values from Display Form or Edit Form pages in SharePoint lists, Use these jQuery scripts:

Get Form field value in Display Form (DispForm.aspx):

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>

<script language="javascript" type="text/javascript">
 
$(document).ready(function() {
     var fldValue = $('h3:contains("Last Name")').closest('td').next('td').text();
     alert(fldValue.trim());
});

</script>

Get Form field value in Edit Form (EditForm.aspx):

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
 
$(document).ready(function() {
  var fldValue = $("input[title*='Last Name']").val();
  alert(fldValue.trim());
});

</script>

Use the control tags and attributes accordingly. E.g. For Drop-downs, Instead of “Input” You got to use “Select” tag. 

Use Firebug/IE developer tool to fetch the Tag/Title/ID attributes of required controls!

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

2 thoughts on “Get Form Field Values from DispForm.aspx, EditForm.aspx Pages in SharePoint

  • Thanks, nice :))

    Reply
  • SAved my day budie. I am your fan.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *