Wednesday, August 6, 2014

SharePoint 2010 - Problems after December 2013 CU install

Recently I installed December 2013 Cumulative Update for SharePoint 2010 on one of my dev machines. CU is described in this post:

http://blogs.technet.com/b/stefan_gossner/archive/2013/12/12/december-2013-cu-for-sharepoint-2010-has-been-released.aspx

But, after installation I began experiencing some problems on my default and custom forms (NewForm.aspx, EditForm.aspx) and some web parts. These pages had custom javascript and were using jQuery and SPServices libraries.

After some investigation, I realized that my scripts were not the problem. Problem was in field names, i.e. CU changed field names on every form (but only for required fields). It added text „Required Field“ in the title of every required field on my form. But real name of that field in Sharepoint won't change, this new name is generated only on *.aspx pages.



For example, if you have a field named "Address" on your NewForm.aspx page (and it is a required field), then this is how HTML of that field looks like on your NewForm.aspx before CU installation:

<input name="ctl00$m$g_7954fc2a_0743_4337_838a_2ccb20bcf887$ctl00$ctl05$ctl00$ctl00$ctl00$ctl04$ctl00$ctl00$TextField"
type="text"
maxlength="255" id="ctl00_m_g_7954fc2a_0743_4337_838a_2ccb20bcf887_ctl00_ctl05_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField"
title="Address"
class="ms-long ms-spellcheck-true" />


And this is how it looks like after CU installation (notice „title“ attribute):

<input name="ctl00$m$g_7954fc2a_0743_4337_838a_2ccb20bcf887$ctl00$ctl05$ctl00$ctl00$ctl00$ctl04$ctl00$ctl00$TextField"
type="text"
maxlength="255" id="ctl00_m_g_7954fc2a_0743_4337_838a_2ccb20bcf887_ctl00_ctl05_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField"
title="Address Required Field"
class="ms-long ms-spellcheck-true" />


So, names of my fields on NewForm.aspx page are changed. What does that mean? This means that, if you are trying to get values of your “Address” field with jQuery like this:

$('input[title="Address"]').val()

…it isn’t possible anymore. You will get ‘undefined’.

You need to change the name of your field:

$('input[title="Address Required Field"]').val()

The same goes if you are using following methods:

Before:

getTagFromIdentifierAndTitle("select", "Lookup", "Address")

After:

getTagFromIdentifierAndTitle("select", "Lookup", "Address Required Field")


If you are using SPServices, then you also need to check field names in these methods, for example, if you are using $().SPServices.SPCascadeDropdowns
This problem is described in the following link:

http://spservices.codeplex.com/discussions/538561

NOTE: This newly added text „Required Field“ is depended on your site's language. „Required Field“ is added only if default language on your site is English. For other languages text „Required Field“ will be localized.

No comments:

Post a Comment