Second Life of a Hungarian SharePoint Geek

August 30, 2011

Issues with the inline editing feature

Filed under: Bugs, Inline editing, SP 2010 — Tags: , , — Peter Holpar @ 22:49

In the past weeks I spent considerable time working with and customizing the inline editing feature of SharePoint. During this work I found a few issues that did not help me to achieve my goals.

Issue 1

If you read my former post about inline editing customization you might have noticed, that the original list contained a SPFieldDateTime field, but the field in the edit mode did not contain the date picker, as shown below:

image

In the standard edit form, the picker is there:

image

My first idea was that there might be a bug with the FormField control used for displaying fields in the inline editing mode when it bounds to a SPFieldDateTime field, so I’ve created a customized XSL template that displayed the SPFieldDateTime field using the DateTimeControl control, but the result was the same.

Checking the Render method of the DateTimeControl class gave the answer for the missing picker. As you can see, if the parent XsltListViewWebPart control is in AutoMode (that is inline editing) the value of the parent variable will be null, and in this case the picker is not rendered. The relevant part of the method:

  1. Control parent = this.Parent;
  2. while (parent != null)
  3. {
  4.     XsltListViewWebPart part = parent as XsltListViewWebPart;
  5.     if (part != null)
  6.     {
  7.         if (!part.AutoMode)
  8.         {
  9.             parent = null;
  10.         }
  11.         break;
  12.     }
  13.     parent = parent.Parent;
  14. }
  15. if (!this.m_timeOnly && (parent == null))
  16. {
  17.     output.WriteLine("<td class=\"ms-dtinput\" >");
  18.     output.WriteFullBeginTag(string.Format(str3, this.m_dateTextBox.ClientID, this.BuildQueryString(), SPHttpUtility.EcmaScriptStringLiteralEncode(str5)));
  19.     output.WriteFullBeginTag(string.Format(str4, this.m_dateTextBox.ClientID + this.m_datepickerImageID, SPHttpUtility.HtmlUrlAttributeEncode(this.getUrlString(this.m_calendarImageUrl, null, null)), SPHttpUtility.HtmlEncode(this.m_calendariconAltText)));
  20.     output.WriteEndTag("img");
  21.     output.WriteEndTag("a");
  22.     output.WriteLine("</td>");
  23.     output.WriteLine("<td>");
  24.     output.WriteFullBeginTag(string.Format(format, this.m_dateTextBox.ClientID + this.m_datepickerFrameID, SPHttpUtility.HtmlEncode(this.m_calendariconAltText)));
  25.     output.WriteEndTag("iframe");
  26.     output.WriteLine("</td>");
  27. }

It’s not clear to me why MS limited the usage of the picker, but it may be related to the fact that the picker is rendered as an IFRAME element in HTML (see the value of the format variable in the full version of the Render method):

string format = "iframe id=\"{0}\" src=\"/_layouts/images/blank.gif\" frameborder=\"0\" scrolling=\"no\" style=\"DISPLAY:none;POSITION:absolute; width:200px; Z-INDEX:101;\" title=\"{1}\"";

Although it is definitely not a user-friendly solution to force the users to enter the date by typing it into a text field instead of using the picker, this issue can be taken as by-design. This cannot be said about the second issue I consider either an incomplete feature or even a bug.

Issue 2

Beside inline editing the field and list validation feature are great new functions in SharePoint 2010 both of them works quite well separately.

For example, I created a simple field validation rule for the Num1 field that requires the numerical value to be positive.

image

On the standard editing form it works as expected:

image

However when the same values were used in the inline editing mode:image

Submitting the changes resulted a List data validation failed. exception:

image

I found the same when set a list validation rule instead of the field validation rule:

image

Editing the field in the standard view worked correctly,

image

using the inline editing mode throws the exception:

image

If the XsltListViewWebPart web part on the view page is configure to use asynchronous update, the error is even stranger.

image

In this case, when you would like to submit your changes, it seems that nothing happens, the inline editing form remains open.

However, the well-know exclamation mark at the left bottom corner of IE shows that something went wrong.

image

Clicking on it displays the following error message:

Message: Sys.WebForms.PageRequestManagerServerErrorException: List data validation failed.
Line: 4723
Char: 21
Code: 0

image

Due to this behaviors I found no way to use validation rules in inline editing mode. I don’t think it was intentional to sign validation errors this way, as I think it would not be a user friendly solution to achieve that goal. Although this error messages strongly resemble me to the ones I found at external list “validation”.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: