SharePoint form: scroll to field as with an anchor tag

I got this request from Cookie:

Is there a way to create an anchor within a NewForm or EditForm? I have a long intake, or it could be long. When I assign the the item to an owner and provide them a link to the form, it would be easier to have an addition to the link with the anchor that links to a specific field in the form. Maybe a script that uses the fieldinternalname and converts that to the anchor name for simplicity.

Place this code in a CEWP below the form in NewForm, EditForm or DispForm:

<script type="text/javascript" src="../../Javascript/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
  This script is used to be able to scroll to a field based upon a url query string parameter like this:

fields = init_fields();

// If the query string parameter "focus" is set, and a field with that FieldInternalName is found, scroll to that field
	var q = getQueryParameters();
		var fin = q['focus'];
			var offset = $(fields[fin]).offset();

// Function to separate each url search string parameters
function getQueryParameters(){
qObj = {};
var urlSearch =;
		var qpart = urlSearch.substring(1).split('&');
			var splitAgain = item.split('=');
			qObj[splitAgain[0]] = splitAgain[1];
return qObj;

// Function to make an object of all tr-tags in the form
function init_fields(){
var res = {};
if($(this).html().indexOf('FieldInternalName="')<0) return; 
var start = $(this).html().indexOf('FieldInternalName="')+19;
var stopp = $(this).html().indexOf('FieldType="')-7; 
var nm = $(this).html().substring(start,stopp);
res[nm] = this.parentNode;
return res;

Make your links up like this:

Look here on how to find the FieldInternalName of your field.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.