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 - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time 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 *