Posts

Showing posts from January, 2015

RESOLVED: Uncaught TypeError: Cannot read property 'parent' of null

While testing a few pages in page editor, I started running into this error:
Uncaught TypeError: Cannot read property 'parent' of null This would happen when trying to add a new component while in edit mode. Since the error wasn't very descriptive and researching it online was leading me down the wrong path as this js error usually occurrs due to collision with jquery plugin ($ issue).

So as a trial and error method I started removing the components one by one to see if the "Add Here" buttons would show up. I was able to trace it back to a listing component that was had a couple of Partial Views included in the markup.

The culprit: Using @Html.PartialView() to rendering partial views within a view rendering.

The fix: For the time being I am checking the Page Mode to load or skip the partial views.

 I know this is not the best solution. Please let me know if someone has a better solution.

I was looking to statically bind the renderings instead of using Partial View…

RESOLVED: Empty strings are not allowed. Parameter name: roleName

A lot of users working with Chrome have been complaining about the below mentioned error:

Exception Details: System.ArgumentException: Empty strings are not allowed. Parameter name: roleName ... Stack Trace: [ArgumentException: Empty strings are not allowed. Parameter name: roleName] Sitecore.Security.Accounts.Role.FromName(String roleName) +257 Sitecore.Shell.Applications.Security.EditUser.EditUserPage.Add_Click() +557 [TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +229 ...
Here is the resolution for it: https://kb.sitecore.net/articles/826753

Implementing Tabbed Select Rendering Dialog in Sitecore new

Image
Looking for better ways to organize components while selecting them using Select Rendering dialog in Page Editor, I came across this module (unable to find it on Sitecore Marketplace) and decided to implement it. The approach seemed pretty straight forward till I actually started implementing it. Here are a few lessons learnt during the implementation.

The idea is to go from this:


To:



Since I couldn't find the module on Sitecore market place I decided to write this post describing the full implementation, including the code:


Find the following file and create a backup <sitecore web root>\sitecore\shell\Applications\Dialogs\SelectRendering\SelectRendering.xml
Edit the file to include the following line below "Renderings" element <Tabstrip ID="Tabs" Width="100%" Height="100%" Background="white" Padding="0px" style="position:absolute; width:100%;top:0px"/>Edit the codebeside element as follows <CodeBe…

Sitecore Tabbed Select Rendering dialog

Image
If you aren't already doing this, you should be!

Found an interesting module (unable to find it on Sitecore Marketplace) to show renderings grouped into tabs while using the Select Rendering dialog from page editor.

The idea is to go from this:


To:




The approach is promising with a few updates:

Tried implementing it by inheriting from SelectRenderingForm and it did not work. No rendering items were being listed. Had to decompile Sitecore.Client.dll and copy the code from Sitecore.Shell.Applications.Dialogs.SelectRendering.SelectRenderingFormHad to comment the following line in OnLoad this.Renderings.InnerHtml = this.RenderPreviews((IEnumerable<Item>)renderingOptions.Items);Found a few issues with the styles, could have be an updated style sheet for Sitecore 7.5, but had to add the following attributes to the tabstripBackground="white" Padding="0px" style="position:absolute; width:100%;top:0px"Here is a detailed description of my implementation.

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Authentication required

Using the default Email Action item for Workflow action in Sitecore 7.2 takes the following parameters:

To (To Email)From (From Email)SubjectMessage (Body)Mail Server (Host)Type (default: Sitecore.Workflows.Simple.EmailAction, Sitecore.Kernel) If the mail server uses authentication, which most email hosts do, you get the following error:

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Authentication required
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Authentication required

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and loca…

Is Rendered Item Valid XHtml Document Could not find schema information warnings during publish item Sitecore 7.2

Image
Note: Since we now live in the HTML5 world, the simple resolution to any XHtml validation errors is to remove the XHtml validation rules on System->Settings->Validation Rules->Global Rules item. Sitecore should update it's validation rules to be relevant to HTML5. This make the rest of this post obsolete :).

I created a simple approval workflow in Sitecore 7.5 and tried to approve an item for publishing and found a bunch of validation errors in the Validation Results. Most of them were related to the "Is Rendered Item Valid XHtml Document" section which looked like this:



The problems were related to violations of the W3C HTML5 recommendation An important note here is: The element containing the character encoding declaration must be serialized completely within the first 1024 bytes of the document.
Adding the following xmlns attribute to the Html tag fixed most of the errors: <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> The inter…

'analytics' connection string is not defined

Typically developers run into this error in their local environment if they do not have Sitecore Analytics enabled but for some reason have a Sitecore.Analytics.config deployed with the following settings enabled:
<!--  ANALYTICS DISABLE DATABASE
            Disables the database so that no reading or writing to the database occurs.
            Default: false
      -->
      <setting name="Analytics.DisableDatabase" value="false" />
<!--  ANALYTICS ENABLED
            Determines whether analytics is enabled or not.
            Default: true
      -->
      <setting name="Analytics.Enabled" value="true" /> Simply disabling the Analytics DB by setting the Analytics.DisableDatabase to "true" solved the problem.

Here is a related blog post about this error.

System.ArgumentException: Empty strings are not allowed. Parameter name: connectionString at Sitecore.Analytics.Data.DataAccess.DataAdapters.Sql.SqlServer.SqlServerDataAdapterProvider..ctor()

Recently one of my developers ran in to the following error when previewing a field of the type "Mutlilist with Search"  in content editor in Sitecore 7.2:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.---> System.ArgumentException: Empty strings are not allowed. Parameter name: connectionString at Sitecore.Data.SqlServer.SqlServerDataApi..ctor(String connectionString) at Sitecore.Analytics.Data.DataAccess.DataAdapters.Sql.SqlServer.SqlServerDataAdapterProvider..ctor() --- End of inner exception stack trace-- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Sitecore.Reflection.ReflectionUtil.CreateObject(Type type, Object[] parameters) at Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] pa…