kwizcom banner advertisement

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!
Get Form Field Values from DispForm.aspx, EditForm.aspx Pages in SharePoint Get Form Field Values from DispForm.aspx, EditForm.aspx Pages in SharePoint Reviewed by Salaudeen Rajack on May 29, 2013 Rating: 5

2 comments:

Please Login and comment to get your questions answered!

Powered by Blogger.