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

Information Technology Professional with Two decades of SharePoint Experience.

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

  • April 26, 2018 at 2:57 PM

    Thanks, nice :))

    Reply
  • December 18, 2017 at 10:34 AM

    SAved my day budie. I am your fan.

    Reply

Leave a Reply