SharePoint 2013 User Profile HTML Properties Lose Values on Edit – Here’s the Work-Around

The Problem

In SharePoint 2013 there is a common problem that occurs when editing a user profile in situations where there is more than one HTML user profile property. In these instances, all the HTML properties except for the last one on the page will lose their values. This problem occurs in both SharePoint 2013 Online and On Premise. And it occurs on both the user profile edit pages accessible from SharePoint Central Administration and from My Sites.

The Reason

The problem is caused by a logical JavaScript error on the user profile edit page. A Java-Script function PopulateEditableRegion() is generated for each HTML property and is responsible for populating the HTML property with its value of the edit page. When there are more than one HTML property, this function runs only for the last HTML property on the page.

function PopulateEditableRegion()
var editableRegion = document.querySelector('[InputFieldId=ProfileEditorEditAboutMe_hiddenRTEField]');
if (editableRegion)
editableRegion.innerHTML = 'Hi, My name is Bilal and I’m a Senior SharePoint Consultant';

function PopulateEditableRegion()
var editableRegion = document.querySelector('[InputFieldId=ProfileEditorEditFunFactNew2_hiddenRTEField]');
if (editableRegion)
editableRegion.innerHTML = ‘I’m working on it :p’;

The Work-Around

Unfortunately there is currently no solution to this problem , and according to Microsoft it will get fixed in a future cumulative update for SharePoint 2013. But there is a work-around for this problem. On the user profile edit page every HTML property has a corresponding hidden input field which holds the value of that HTML property.

<input type="hidden" name="ProfileEditorEditAboutMe_hiddenRTEField" id="ProfileEditorEditAboutMe_hiddenRTEField" value="Hi, My name is Bilal and I’m a Senior SharePoint Consultant" />

<input type="hidden" name="ProfileEditorEditFunFactNew2_hiddenRTEField" id="ProfileEditorEditFunFactNew2_hiddenRTEField" value="I’m working on it :p" />

The following JavaScript takes the value from the hidden field and populates the corresponding HTMLproperty.

<script type="text/javascript">
var aboutme = document.querySelector('[InputFieldId=ProfileEditorEditAboutMe_hiddenRTEField]');
aboutme.innerHTML = $("input[type='hidden'][name='ProfileEditorEditAboutMe_hiddenRTEField']").val();

var funfact = document.querySelector('[InputFieldId=ProfileEditorEditFunFactNew2_hiddenRTEField]');
funfact.innerHTML = $("input[type='hidden'][name='ProfileEditorEditFunFactNew2_hiddenRTEField']").val();

Feel free to reach out should you have any questions or need help with SharePoint 2013.

Written by:
Bilal Amjad, Senior SharePoint Specialist

Posted by: 

 FMT Consultants, LLC.
Privacy Policy

Contact Us


Newsletter Sign-up

menu linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram