Sitecore 8.1 WFFM with MVC: Insert Form in Content Editor

In the latest versions of Sitecore, the trend is more and more to use MVC. So having an MVC project, built on Sitecore XP 8.1 rev.151003 (Initial Release) version, and wanting to use the Web Forms For Marketers module, version 8.1 rev. 151008, entails that we want to use the MVC Form rendering, instead of the classic Form sublayout. For a developer, this works perfectly well, but as a Content Editor, I encountered the issue that I could not select any placeholders in the Insert Form wizard. At first, I thought that the explanation for my issue is the same as the one in this article: It mainly has to do with the fact that in the Insert Form wizard, you will need to select the placeholder on which to add the form, but the list of placeholders cannot be created by Sitecore, because it scans the current page looking for sc:Placeholder controls, which are no longer used in MVC. But later on, I found out that this is not the case for my solution. In my case, there was a custom pipeline HttpRequestProcessor that interfered with the Insert Form wizard, so I found a workaround without changing the code from the custom pipeline.

The scenario is this:

1.) First, you open the Insert Form wizard:InsertForm

2.) Enter a name for the form, and click on either Create a blank form or Select a form to copy:


3.) In the Select a Placeholder screen, you have to select something, otherwise, you cannot proceed to the next step. But in this case, instead of the placeholder list you would expect, the current item url is loaded inside the small wizard, which is a showstopper.

The solution to this problem begins with identifying where the request for placeholders is performed. This is done in a javascript file installed with the WFFM module: <website>\sitecore\shell\Applications\Modules\Web Forms for Marketers\script\Sitecore.PlaceholderManager.js. In the getPlaceholders function, we need to replace the Ajax request to the current url with an Ajax request to our own implementation of displaying the placeholder list. For this, we need a new very simple controller and a view in our project:


public class MvcFormController : Controller
    public ActionResult Index()
        return this.View();


<a id="ph_wffm" href="#" class="scPalettePlaceholder" title="wffm" onclick="Sitecore.PlaceholderManager.onPlaceholderClick(this, event, 'wffm');">
    <div class="scPalettePlaceholderTitle">wffm</div>
    <div class="scPalettePlaceholderTooltip" style="display: none">wffm</div>

In my case, I only need a single placeholder called ”wffm”. This was previously added in Sitecore, under Placeholder Settings:


Of course the logic can be taken even further, so that the placeholder list is retrieved dynamically. But in my case, this solution was good enough.

In the Sitecore.PlaceholderManager.js file, in the getPlaceholders function, we can adjust the Ajax request to our action:

this.getPlaceholders = function (url, success, failure) {
    if (url != null && url != '') {
        new Ajax.Request('/api/sitecore/MvcForm/Index', {
            method: 'get',
            asynchronous: false,
            onSuccess: function (transport) {
            onFailure: function (transport) {
    else {

Now, when I perform again the steps from my scenario, I can see the following screen for selecting the placeholder:


Remember to properly clear the cache of your browser before trying the scenario, so that you make sure that the changes in javascript are taken into consideration.

Sitecore 8.1 Language Dropdown Sorting in Content Editor

If you have any little experience with Sitecore, you know that the languages available for the website can be maintained under System->Languages, and that they can be seen in the Content Editor, in a dropdown on the right side. But in what order are they displayed in the dropdown and how to change this if we want? My project is built on Sitecore XP 8.1 rev. 160302, and this is actually the first version where Sitecore provides an easy way to change the language ordering.

Below I have the language dropdown with the initial order:


There is a setting in Sitecore.config, suggestively called ContentEditor.SortLanguages, which by default is set to false. This means that by default, the dropdown displays the languages in the order they were created. If I change this setting to true, the display order in the dropdown will be the same as the order from System->Languages, which is controlled by the Sort Order field of each Language item.


If you somehow don’t see the setting in Sitecore.config, this is how you define it:

      Indicates whether the Content Editor show languages in the language selection dropdown
      in the same order as /sitecore/system/Languages child items.
      Default value: false
<setting name="ContentEditor.SortLanguages" value="true"/>

Using a decompiler, you can see that this setting is checked in the OnLoad() method from Sitecore.Shell.Applications.ContentManager.Galleries.Languages.GalleryLanguagesForm (Sitecore.Client.dll):

if (Settings.ContentEditor.get_SortLanguages())
    languages = languages.OrderBy<Language, Language>(delegate(Language x)
        return x;
    }, new LanguageComparer(currentItem.Database));

After changing the setting, I can see the languages in the dropdown ordered as in System->Languages:


If you want even more language dropdown customization, you could do this by opening the file ”<website>\sitecore\shell\Applications\Content Manager\Galleries\Languages\Gallery Languages.xml” and replacing the call to GalleryLanguagesForm (Sitecore.Client.dll) in the CodeBeside tag with your own class containing the custom code.